| | |
| | | var sql = @"select A.id, A.status,A.wotype,A.printcount,A.wo_code,A.materiel_code as partcode,B.partname,B.partspec,A.plan_qty,A.wkshp_code,C.org_name as wkshp_name, |
| | | A.route_code,E.name as route_name,A.stck_code,F.name as stck_name,A.plan_startdate,A.plan_enddate,A.piroque,A.sourceid,A.m_po,W.saleOrderCode,U.username as lm_user,A.lm_date |
| | | from TK_Wrk_Man A |
| | | left join TKimp_Ewo W on A.m_po=W.wo and A.materiel_code=W.materiel_code |
| | | left join TKimp_Ewo W on A.m_po=W.wo and A.materiel_code=W.materiel_code and A.sourceid=W.id |
| | | left join TMateriel_Info B on A.materiel_code=B.partcode |
| | | left join TOrganization C on A.wkshp_code=C.org_code |
| | | left join T_Sec_Stck D on A.stck_code=D.code |
| | |
| | | var sql = @"select A.id, A.status,A.wotype,A.wo_code,A.materiel_code as partcode,B.partname,B.partspec,A.plan_qty,A.wkshp_code,C.org_name as wkshp_name, |
| | | A.route_code,E.name as route_name,A.stck_code,F.name as stck_name,A.plan_startdate,A.plan_enddate,A.piroque,A.sourceid,A.m_po,W.saleOrderCode,U.username as lm_user,A.lm_date,S.bad_qty |
| | | from TK_Wrk_Man A |
| | | left join TKimp_Ewo W on A.m_po=W.wo and A.materiel_code=W.materiel_code |
| | | left join TKimp_Ewo W on A.m_po=W.wo and A.materiel_code=W.materiel_code and A.sourceid=W.id |
| | | left join (select wo_code,sum(bad_qty) as bad_qty from TK_Wrk_Step where bad_qty>0 group by wo_code) S on A.wo_code=S.wo_code |
| | | left join TMateriel_Info B on A.materiel_code=B.partcode |
| | | left join TOrganization C on A.wkshp_code=C.org_code |
| | |
| | | #endregion |
| | | |
| | | #region[生产开报工扫码获取工单对应工序任务(自制)] |
| | | public static ToMessage MesOrderStepSearch(string stu_torgcode, string stu_torgtypecode, string wocode,string partcode,string partname,string partspec, int startNum, int endNum, string prop, string order) |
| | | public static ToMessage MesOrderStepSearch(string stu_torgcode, string stu_torgtypecode, string wocode, string saleOrderCode, string partcode, string partname, string partspec, int startNum, int endNum, string prop, string order) |
| | | { |
| | | var sql = ""; |
| | | string search = ""; |
| | |
| | | default: |
| | | break; |
| | | } |
| | | if (saleOrderCode != "" && saleOrderCode != null) |
| | | { |
| | | search += "and W.saleOrderCode like '%'+@saleOrderCode+'%' "; |
| | | dynamicParams.Add("@saleOrderCode", saleOrderCode); |
| | | } |
| | | if (partcode != "" && partcode != null) |
| | | { |
| | | search += "and M.partcode like '%'+@partcode+'%' "; |
| | |
| | | B.m_po,W.saleOrderCode |
| | | from TK_Wrk_Step A |
| | | left join TK_Wrk_Man B on A.wo_code=B.wo_code |
| | | left join TKimp_Ewo W on B.m_po=W.wo and B.materiel_code=W.materiel_code |
| | | left join TKimp_Ewo W on B.m_po=W.wo and B.materiel_code=W.materiel_code and B.sourceid=W.id |
| | | left join TMateriel_Info M on B.materiel_code=M.partcode |
| | | left join TStep S on A.step_code=S.stepcode |
| | | left join TOrganization F on B.wkshp_code=F.org_code |
| | |
| | | B.m_po,W.saleOrderCode |
| | | from TK_Wrk_Step A |
| | | left join TK_Wrk_Man B on A.wo_code=B.wo_code |
| | | left join TKimp_Ewo W on B.m_po=W.wo and B.materiel_code=W.materiel_code |
| | | left join TKimp_Ewo W on B.m_po=W.wo and B.materiel_code=W.materiel_code and B.sourceid=W.id |
| | | left join TMateriel_Info M on B.materiel_code=M.partcode |
| | | left join TStep S on A.step_code=S.stepcode |
| | | left join TOrganization F on B.wkshp_code=F.org_code |
| | |
| | | B.m_po,W.saleOrderCode |
| | | from TK_Wrk_Step A |
| | | left join TK_Wrk_Man B on A.wo_code=B.wo_code |
| | | left join TKimp_Ewo W on B.m_po=W.wo and B.materiel_code=W.materiel_code |
| | | left join TKimp_Ewo W on B.m_po=W.wo and B.materiel_code=W.materiel_code and B.sourceid=W.id |
| | | left join TMateriel_Info M on B.materiel_code=M.partcode |
| | | left join TStep S on A.step_code=S.stepcode |
| | | left join TOrganization F on B.wkshp_code=F.org_code |
| | |
| | | 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 TKimp_Ewo W on M.m_po=W.wo and M.materiel_code=W.materiel_code |
| | | left join TKimp_Ewo W on M.m_po=W.wo and M.materiel_code=W.materiel_code and M.sourceid=W.id |
| | | left join TMateriel_Info P on M.materiel_code=P.partcode |
| | | where A.wo_code=@ordercode and A.step_code=@stepcode"; |
| | | dynamicParams.Add("@ordercode", ordercode); |
| | |
| | | { |
| | | //修改开报工记录表(开工数量) |
| | | sql = @"update TK_Wrk_Record set start_qty=start_qty+@startqty where wo_code=@mesordercode and step_seq=@stepseq and step_code=@stepcode and materiel_code=@partcode and style=@style"; |
| | | list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepseq = stepseq, stepcode = stepcode, partcode = partcode, startqty = startqty, style = "S"} }); |
| | | list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepseq = stepseq, stepcode = stepcode, partcode = partcode, startqty = startqty, style = "S" } }); |
| | | //修改工单工序表(开工数量) |
| | | sql = @"update TK_Wrk_Step set start_qty=start_qty+@startqty where wo_code=@mesordercode and step_code=@stepcode"; |
| | | list.Add(new { str = sql, parm = new { mesordercode = mesordercode,stepcode = stepcode, startqty = startqty } }); |
| | | list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepcode = stepcode, startqty = startqty } }); |
| | | } |
| | | else |
| | | else |
| | | { |
| | | //写入开报工记录表 |
| | | sql = @"insert into TK_Wrk_Record(wo_code,step_seq,step_code,eqp_code,materiel_code,open_person,open_time,task_qty,start_qty,style,lm_user,lm_date) |
| | |
| | | list.Add(new { str = sql, parm = new { mesordercode = mesordercode } }); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | bool aa = DapperHelper.DoTransaction(list); |
| | | if (aa) |
| | |
| | | ,(select sum(S.ng_qty) from TK_Wrk_Step S where S.wo_code=A.wo_code and S.isend='Y') as ng_qty |
| | | ,(select sum(S.bad_qty) from TK_Wrk_Step S where S.wo_code=A.wo_code and S.isend='Y') as bad_qty |
| | | from TK_Wrk_Man A |
| | | left join TKimp_Ewo W on A.m_po=W.wo and A.materiel_code=W.materiel_code |
| | | left join TKimp_Ewo W on A.m_po=W.wo and A.materiel_code=W.materiel_code and A.sourceid=W.id |
| | | left join TMateriel_Info B on A.materiel_code=B.partcode |
| | | left join TOrganization C on A.wkshp_code=C.org_code |
| | | left join T_Sec_Stck D on A.stck_code=D.code |
| | |
| | | inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.step_code=S.step_code |
| | | inner join TK_Wrk_Man M on S.wo_code=M.wo_code |
| | | inner join TMateriel_Info P on M.materiel_code=P.partcode |
| | | left join TKimp_Ewo E on M.sourceid=E.id |
| | | left join TKimp_Ewo E on M.sourceid=E.id |
| | | left join T_Sec_Stck K on E.stck_code=K.code |
| | | where A.style='B' and S.isend='Y' and A.good_qty>0 |
| | | union all |