| | |
| | | } |
| | | |
| | | //1.根据工单+工序查找当前工序是否首道工序 |
| | | sql = @"select A.wo_code,P.partcode,P.partname,P.partspec, T.stepcode,T.stepname,A.stepprice,A.seq,T.flwtype,T.descr,A.status,A.plan_qty,A.isbott,A.isend,L.org_code,L.org_name |
| | | sql = @"select A.wo_code,P.partcode,P.partname,P.partspec, T.stepcode,T.stepname,A.stepprice,A.seq,T.flwtype,T.descr,A.status,A.plan_qty,A.isbott,A.isend,L.torg_code,L.torg_name |
| | | from TK_Wrk_Step A |
| | | left join TStep T on A.step_code=T.stepcode |
| | | left join TK_Wrk_Man M on A.wo_code=M.wo_code |
| | | left join TMateriel_Info P on M.materiel_code=P.partcode |
| | | left join TOrganization L on M.wkshp_code=L.org_code |
| | | left join TOrganization L on M.wkshp_code=L.torg_code |
| | | where A.wo_code=@ordercode and A.step_code=@stepcode"; |
| | | dynamicParams.Add("@ordercode", ordercode); |
| | | dynamicParams.Add("@stepcode", stepcode); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | if (data.Rows.Count > 0) |
| | | { |
| | | rt.wkshopcode = data.Rows[0]["org_code"].ToString(); //车间编码 |
| | | rt.wkshopname = data.Rows[0]["org_name"].ToString(); //车间名称 |
| | | rt.wkshopcode = data.Rows[0]["torg_code"].ToString(); //车间编码 |
| | | rt.wkshopname = data.Rows[0]["torg_name"].ToString(); //车间名称 |
| | | rt.wo_code = data.Rows[0]["WO_CODE"].ToString(); //工单号 |
| | | rt.partnumber = data.Rows[0]["PARTCODE"].ToString(); //产品编码 |
| | | rt.partname = data.Rows[0]["PARTNAME"].ToString(); //产品名称 |
| | |
| | | { |
| | | rt.nextstepcode = dt.Rows[0]["STEPCODE"].ToString();//下道工序编码 |
| | | rt.nextstepname = dt.Rows[0]["STEPNAME"].ToString();//下道工序名称 |
| | | rt.nextstepprice = data.Rows[0]["NEXTSTEPPRICE"].ToString(); //下道工序工价 |
| | | rt.nextstepprice = dt.Rows[0]["STEPPRICE"].ToString(); //下道工序工价 |
| | | } |
| | | if (isend == "Y") //当前工序是末道工序 |
| | | { |
| | |
| | | } |
| | | |
| | | //1.根据工单+工序查找当前工序是否首道工序 |
| | | sql = @"select A.wo_code,P.partcode,P.partname,P.partspec, T.stepcode,T.stepname,A.seq,T.flwtype,T.descr,A.stepprice,A.status,A.plan_qty,A.isbott,A.isend,L.org_code,L.org_name |
| | | sql = @"select A.wo_code,P.partcode,P.partname,P.partspec, T.stepcode,T.stepname,A.seq,T.flwtype,T.descr,A.stepprice,A.status,A.plan_qty,A.isbott,A.isend,L.torg_code,L.torg_name |
| | | from TK_Wrk_Step A |
| | | left join TStep T on A.step_code=T.stepcode |
| | | left join TK_Wrk_Man M on A.wo_code=M.wo_code |
| | | left join TMateriel_Info P on M.materiel_code=P.partcode |
| | | left join TOrganization L on M.wkshp_code=L.org_code |
| | | left join TOrganization L on M.wkshp_code=L.torg_code |
| | | where A.wo_code=@ordercode and A.step_code=@stepcode"; |
| | | dynamicParams.Add("@ordercode", ordercode); |
| | | dynamicParams.Add("@stepcode", stepcode); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | if (data.Rows.Count > 0) |
| | | { |
| | | rt.wkshopcode = data.Rows[0]["org_code"].ToString(); //车间编码 |
| | | rt.wkshopname = data.Rows[0]["org_name"].ToString(); //车间名称 |
| | | rt.wkshopcode = data.Rows[0]["torg_code"].ToString(); //车间编码 |
| | | rt.wkshopname = data.Rows[0]["torg_name"].ToString(); //车间名称 |
| | | rt.wo_code = data.Rows[0]["WO_CODE"].ToString(); //工单号 |
| | | rt.partnumber = data.Rows[0]["PARTCODE"].ToString(); //产品编码 |
| | | rt.partname = data.Rows[0]["PARTNAME"].ToString(); //产品名称 |
| | |
| | | { |
| | | rt.nextstepcode = dt.Rows[0]["STEPCODE"].ToString();//下道工序编码 |
| | | rt.nextstepname = dt.Rows[0]["STEPNAME"].ToString();//下道工序名称 |
| | | rt.nextstepprice = data.Rows[0]["NEXTSTEPPRICE"].ToString(); //下道工序工价 |
| | | rt.nextstepprice = dt.Rows[0]["STEPPRICE"].ToString(); //下道工序工价 |
| | | } |
| | | if (isend == "Y") //当前工序是末道工序 |
| | | { |
| | |
| | | { |
| | | //1.首道工序时,判断是否有发料记录 |
| | | sql = @"select R.wo_code,R.step_code,R.wx_code as code,C.name,R.materiel_code, |
| | | isnull(sum(R.fqty),0) as fqty,isnull(sum(R.sqty),0) as sqty,isnull(sum(R.ng_qty),0) as ng_qty,isnull(sum(R.bad_qty),0) as bad_qty |
| | | isnull(sum(R.fqty),0) as fqty,isnull(sum(R.sqty),0) as sqty,isnull(sum(R.ng_qty),0) as ng_qty,isnull(sum(R.laborbad_qty),0) as laborbad_qty,isnull(sum(R.materielbad_qty),0) as materielbad_qty |
| | | from TK_Wrk_OutRecord R |
| | | left join TCustomer C on R.wx_code=C.code |
| | | where R.wo_code=@ordercode and R.step_code=@stepcode and R.style='F' |
| | |
| | | { |
| | | //1.首道工序时,判断是否有收料记录 |
| | | sql = @"select R.wo_code,R.step_code,R.wx_code as code,C.name,R.materiel_code, |
| | | isnull(sum(R.fqty),0) as fqty,isnull(sum(R.sqty),0) as sqty,isnull(sum(R.ng_qty),0) as ng_qty,isnull(sum(R.bad_qty),0) as bad_qty |
| | | isnull(sum(R.fqty),0) as fqty,isnull(sum(R.sqty),0) as sqty,isnull(sum(R.ng_qty),0) as ng_qty,isnull(sum(R.laborbad_qty),0) as laborbad_qty,isnull(sum(R.materielbad_qty),0) as materielbad_qty |
| | | from TK_Wrk_OutRecord R |
| | | left join TCustomer C on R.wx_code=C.code |
| | | where R.wo_code=@ordercode and R.step_code=@stepcode and R.style='S' |
| | |
| | | fqty = g.Sum(i => (decimal)i["fqty"]), |
| | | sqty = g.Sum(i => (decimal)i["sqty"]), |
| | | ng_qty = g.Sum(i => (decimal)i["ng_qty"]), |
| | | bad_qty = g.Sum(i => (decimal)i["bad_qty"]) |
| | | laborbad_qty = g.Sum(i => (decimal)i["laborbad_qty"]), |
| | | materielbad_qty = g.Sum(i => (decimal)i["materielbad_qty"]) |
| | | }).ToList(); |
| | | |
| | | mes.code = "200"; |
| | |
| | | fqty = g.Sum(i => (decimal)i["fqty"]), |
| | | sqty = g.Sum(i => (decimal)i["sqty"]), |
| | | ng_qty = g.Sum(i => (decimal)i["ng_qty"]), |
| | | bad_qty = g.Sum(i => (decimal)i["bad_qty"]) |
| | | laborbad_qty = g.Sum(i => (decimal)i["laborbad_qty"]), |
| | | materielbad_qty = g.Sum(i => (decimal)i["materielbad_qty"]) |
| | | }).ToList(); |
| | | |
| | | mes.code = "200"; |
| | |
| | | { |
| | | //1.非首道工序时,判断本道是否有发料记录 |
| | | sql = @"select R.wo_code,R.step_code,R.wx_code as code,C.name,R.materiel_code, |
| | | isnull(sum(R.fqty),0) as fqty,isnull(sum(R.sqty),0) as sqty,isnull(sum(R.ng_qty),0) as ng_qty,isnull(sum(R.bad_qty),0) as bad_qty |
| | | isnull(sum(R.fqty),0) as fqty,isnull(sum(R.sqty),0) as sqty,isnull(sum(R.ng_qty),0) as ng_qty,isnull(sum(R.laborbad_qty),0) as laborbad_qty,isnull(sum(R.materielbad_qty),0) as materielbad_qty |
| | | from TK_Wrk_OutRecord R |
| | | left join TCustomer C on R.wx_code=C.code |
| | | where R.wo_code=@ordercode and R.step_code=@stepcode and R.style='F' |
| | |
| | | { |
| | | //2.非首道工序时,判断本道是否有收料记录 |
| | | sql = @"select R.wo_code,R.step_code,R.wx_code as code,C.name,R.materiel_code, |
| | | isnull(sum(R.fqty),0) as fqty,isnull(sum(R.sqty),0) as sqty,isnull(sum(R.ng_qty),0) as ng_qty,isnull(sum(R.bad_qty),0) as bad_qty |
| | | isnull(sum(R.fqty),0) as fqty,isnull(sum(R.sqty),0) as sqty,isnull(sum(R.ng_qty),0) as ng_qty,isnull(sum(R.laborbad_qty),0) as laborbad_qty,isnull(sum(R.materielbad_qty),0) as materielbad_qty |
| | | from TK_Wrk_OutRecord R |
| | | left join TCustomer C on R.wx_code=C.code |
| | | where R.wo_code=@ordercode and R.step_code=@stepcode and R.style='S' |
| | |
| | | fqty = g.Sum(i => (decimal)i["fqty"]), |
| | | sqty = g.Sum(i => (decimal)i["sqty"]), |
| | | ng_qty = g.Sum(i => (decimal)i["ng_qty"]), |
| | | bad_qty = g.Sum(i => (decimal)i["bad_qty"]) |
| | | laborbad_qty = g.Sum(i => (decimal)i["laborbad_qty"]), |
| | | materielbad_qty = g.Sum(i => (decimal)i["materielbad_qty"]) |
| | | }).ToList(); |
| | | |
| | | mes.code = "200"; |
| | |
| | | fqty = g.Sum(i => (decimal)i["fqty"]), |
| | | sqty = g.Sum(i => (decimal)i["sqty"]), |
| | | ng_qty = g.Sum(i => (decimal)i["ng_qty"]), |
| | | bad_qty = g.Sum(i => (decimal)i["bad_qty"]) |
| | | laborbad_qty = g.Sum(i => (decimal)i["laborbad_qty"]), |
| | | materielbad_qty = g.Sum(i => (decimal)i["materielbad_qty"]) |
| | | }).ToList(); |
| | | mes.code = "200"; |
| | | mes.count = 3; |