| | |
| | | } |
| | | if (wkshopcode != "" && wkshopcode != null) |
| | | { |
| | | search += "and A.wkshp_code=@wkshopcode "; |
| | | dynamicParams.Add("@wkshopcode", wkshopcode); |
| | | string[] wkshoplist = Array.ConvertAll<string, string>(wkshopcode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string分割转string[] |
| | | search += "and A.wkshp_code in @wkshoplist "; |
| | | dynamicParams.Add("@wkshoplist", wkshoplist); |
| | | } |
| | | if (erpordercode != "" && erpordercode != null) |
| | | { |
| | |
| | | var dynamicParams = new DynamicParameters(); |
| | | try |
| | | { |
| | | sql = @"select * from TK_Wrk_Man where m_po=@erpordercode and status<> 'CLOSED'"; |
| | | sql = @"select * from TK_Wrk_Man where m_po=@erpordercode and sourceid=@sourceid"; |
| | | dynamicParams.Add("@erpordercode", erpordercode); |
| | | dynamicParams.Add("@sourceid", erporderid); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | if (data.Rows.Count > 0) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = "当前订单有下达未关闭的MES工单,订单不允许关闭,请先删除或关闭相关工单!"; |
| | | mes.data = null; |
| | | } |
| | | else |
| | | { |
| | | //关闭订单 |
| | | sql = @"update TKimp_Ewo set status='CLOSED' where wo=@wo and id=@erporderid"; |
| | | // 使用LINQ和lambda表达式来转换wo_code字段的值为逗号隔开的字符串数组 |
| | | string[] result = data.AsEnumerable().Select(row => "" + row.Field<string>("wo_code") + "").ToArray(); |
| | | //关闭工序任务 |
| | | sql = @"update TK_Wrk_Step set status='CLOSED',closebeforestatus=status where wo_code in @wocode"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | wo = erpordercode, |
| | | erporderid = erporderid |
| | | wocode = result |
| | | } |
| | | }); |
| | | //关闭工单 |
| | | sql = @"update TK_Wrk_Man set status='CLOSED',closebeforestatus=status where m_po=@erpordercode and sourceid=@sourceid"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | erpordercode = erpordercode, |
| | | sourceid = erporderid |
| | | } |
| | | }); |
| | | } |
| | | //关闭订单 |
| | | sql = @"update TKimp_Ewo set status='CLOSED',closebeforestatus=status where wo=@wo and id=@erporderid"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | wo = erpordercode, |
| | | erporderid = erporderid |
| | | } |
| | | }); |
| | | bool aa = DapperHelper.DoTransaction(list); |
| | | if (aa) |
| | | { |
| | |
| | | } |
| | | if (wkshopcode != "" && wkshopcode != null) |
| | | { |
| | | search += "and A.wkshp_code=@wkshopcode "; |
| | | dynamicParams.Add("@wkshopcode", wkshopcode); |
| | | string[] wkshoplist = Array.ConvertAll<string, string>(wkshopcode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string分割转string[] |
| | | search += "and A.wkshp_code in @wkshoplist "; |
| | | dynamicParams.Add("@wkshoplist", wkshoplist); |
| | | } |
| | | if (mesordercode != "" && mesordercode != null) |
| | | { |
| | |
| | | } |
| | | if (saleordercode != "" && saleordercode != null) |
| | | { |
| | | search += "and W.saleOrderCode like '%'+@saleordercode+'%' "; |
| | | search += "and A.saleOrderCode like '%'+@saleordercode+'%' "; |
| | | dynamicParams.Add("@saleordercode", saleordercode); |
| | | } |
| | | if (ordertype != "" && ordertype != null) |
| | |
| | | } |
| | | // --------------查询指定数据-------------- |
| | | var total = 0; //总条数 |
| | | var sql = @"select A.id, A.status,A.wotype,A.wo_code,A.materiel_code as partcode,B.partname,B.partspec,A.route_code,B.default_route,R.name as route_name,A.plan_qty,A.wkshp_code,C.torg_name as wkshp_name, |
| | | A.stck_code,D.name as stck_name,A.plan_startdate,A.plan_enddate,A.piroque,A.sourceid,A.m_po,A.saleOrderDeliveryDate,W.saleOrderCode,U.username as lm_user,A.lm_date,A.data_sources,A.isstep,A.clerkuser, |
| | | var sql = @"select A.id, A.status,A.wotype,A.wo_code,A.materiel_code as partcode,B.partname,B.partspec,A.idTopInventory,A.TopInventoryCode,A.TopInventoryName,A.route_code,B.default_route,R.name as route_name,A.plan_qty,A.wkshp_code,C.torg_name as wkshp_name, |
| | | A.stck_code,D.name as stck_name,A.plan_startdate,A.plan_enddate,A.piroque,A.sourceid,A.m_po,A.saleOrderDeliveryDate,A.saleOrderCode,U.username as lm_user,A.lm_date,A.data_sources,A.isstep,A.clerkuser, |
| | | B.priuserdefnvc1,B.priuserdefnvc2,B.priuserdefnvc3,B.priuserdefnvc4,B.priuserdefnvc5,B.priuserdefnvc6,A.printcount |
| | | from TK_Wrk_Man A |
| | | left join TKimp_Ewo W on A.m_po=W.wo and A.materiel_code=W.materiel_code and A.sbid=W.sbid |
| | |
| | | } |
| | | // --------------查询指定数据-------------- |
| | | var total = 0; //总条数 |
| | | 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.torg_name as wkshp_name, |
| | | var sql = @"select A.id, A.status,A.wotype,A.wo_code,A.materiel_code as partcode,B.partname,B.partspec,A.idTopInventory,A.TopInventoryCode,A.TopInventoryName,A.plan_qty,A.wkshp_code,C.torg_name as wkshp_name, |
| | | A.stck_code,D.name as stck_name,A.plan_startdate,A.plan_enddate,A.piroque,A.sourceid,A.m_po,A.saleOrderDeliveryDate,W.saleOrderCode,U.username as lm_user,A.lm_date,S.laborbad_qty,S.materielbad_qty, |
| | | B.priuserdefnvc1,B.priuserdefnvc2,B.priuserdefnvc3,B.priuserdefnvc4,B.priuserdefnvc5,B.priuserdefnvc6 |
| | | from TK_Wrk_Man A |
| | |
| | | if (operType == "Add") |
| | | { |
| | | //写入工单表 |
| | | sql = @"insert into TK_Wrk_Man(wo_code,wotype,status,wkshp_code,plan_qty,lm_user,lm_date,materiel_code,route_code,sourceid,m_po,saleOrderDeliveryDate,plan_startdate,plan_enddate,piroque,isaps,data_sources,isstep) |
| | | values(@wo_code,@wotype,@status,@wkshp_code,@plan_qty,@lm_user,@lm_date,@materiel_code,@route_code,@sourceid,@m_po,@saleOrderDeliveryDate,@plan_startdate,@plan_enddate,@orderlev,@isaps,@data_sources,@isstep)"; |
| | | sql = @"insert into TK_Wrk_Man(wo_code,wotype,status,wkshp_code,plan_qty,lm_user,lm_date,materiel_code,route_code,sourceid,saleOrderCode,m_po,saleOrderDeliveryDate,plan_startdate,plan_enddate,piroque,isaps,data_sources,isstep) |
| | | values(@wo_code,@wotype,@status,@wkshp_code,@plan_qty,@lm_user,@lm_date,@materiel_code,@route_code,@sourceid,@saleOrderCode,@m_po,@saleOrderDeliveryDate,@plan_startdate,@plan_enddate,@orderlev,@isaps,@data_sources,@isstep)"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | |
| | | materiel_code = json.partcode, |
| | | route_code = route_code, |
| | | sourceid = json.sourceid == "" ? null : json.sourceid, //无源单时赋值NULL |
| | | saleOrderCode=json.saleordercode, |
| | | m_po = json.sourcewo, |
| | | saleOrderDeliveryDate = json.deliverydate, |
| | | plan_startdate = json.paystartdate, |
| | |
| | | { |
| | | //修改工单表 |
| | | sql = @"update TK_Wrk_Man set wotype=@wotype,wkshp_code=@wkshp_code,plan_qty=@plan_qty,lm_user=@lm_user,lm_date=@lm_date, |
| | | materiel_code=@materiel_code,route_code=@route_code,sourceid=@sourceid,m_po=@m_po,saleOrderDeliveryDate=@saleOrderDeliveryDate,plan_startdate=@plan_startdate,plan_enddate=@plan_enddate,isstep=@isstep |
| | | materiel_code=@materiel_code,route_code=@route_code,sourceid=@sourceid,saleOrderCode=@saleOrderCode,m_po=@m_po,saleOrderDeliveryDate=@saleOrderDeliveryDate,plan_startdate=@plan_startdate,plan_enddate=@plan_enddate,isstep=@isstep |
| | | where wo_code=@wo_code"; |
| | | list.Add(new |
| | | { |
| | |
| | | materiel_code = json.partcode, |
| | | route_code = route_code, |
| | | sourceid = json.sourceid == "" ? null : json.sourceid, //无源单时赋值NULL |
| | | saleOrderCode = json.saleordercode, |
| | | m_po = json.sourcewo, |
| | | saleOrderDeliveryDate = json.deliverydate, |
| | | plan_startdate = json.paystartdate, |
| | |
| | | { |
| | | route_code = json[i].routecode; |
| | | //写入工单表 |
| | | sql = @"insert into TK_Wrk_Man(wo_code,wotype,status,wkshp_code,plan_qty,lm_user,lm_date,materiel_code,route_code,sourceid,m_po,saleOrderDeliveryDate,plan_startdate,plan_enddate,piroque,isaps,data_sources,isstep) |
| | | values(@wo_code,@wotype,@status,@wkshp_code,@plan_qty,@lm_user,@lm_date,@materiel_code,@route_code,@sourceid,@m_po,@saleOrderDeliveryDate,@plan_startdate,@plan_enddate,@orderlev,@isaps,@data_sources,@isstep)"; |
| | | sql = @"insert into TK_Wrk_Man(wo_code,wotype,status,wkshp_code,plan_qty,lm_user,lm_date,materiel_code,route_code,sourceid,saleOrderCode,m_po,saleOrderDeliveryDate,plan_startdate,plan_enddate,piroque,isaps,data_sources,isstep) |
| | | values(@wo_code,@wotype,@status,@wkshp_code,@plan_qty,@lm_user,@lm_date,@materiel_code,@route_code,@sourceid,@saleOrderCode,@m_po,@saleOrderDeliveryDate,@plan_startdate,@plan_enddate,@orderlev,@isaps,@data_sources,@isstep)"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | |
| | | materiel_code = json[i].partcode, |
| | | route_code = route_code, |
| | | sourceid = json[i].sourceid == "" ? null : json[i].sourceid, //无源单时赋值NULL |
| | | saleOrderCode=json[i].saleordercode, |
| | | m_po = json[i].sourcewo, |
| | | saleOrderDeliveryDate = json[i].deliverydate, |
| | | plan_startdate = json[i].paystartdate, |
| | |
| | | route_code = json[i].routecode; |
| | | //修改工单表 |
| | | sql = @"update TK_Wrk_Man set wotype=@wotype,wkshp_code=@wkshp_code,plan_qty=@plan_qty,lm_user=@lm_user,lm_date=@lm_date, |
| | | materiel_code=@materiel_code,route_code=@route_code,sourceid=@sourceid,m_po=@m_po,saleOrderDeliveryDate=@saleOrderDeliveryDate,plan_startdate=@plan_startdate,plan_enddate=@plan_enddate,isstep=@isstep |
| | | materiel_code=@materiel_code,route_code=@route_code,sourceid=@sourceid,saleOrderCode=@saleOrderCode,m_po=@m_po,saleOrderDeliveryDate=@saleOrderDeliveryDate,plan_startdate=@plan_startdate,plan_enddate=@plan_enddate,isstep=@isstep |
| | | where wo_code=@wo_code"; |
| | | list.Add(new |
| | | { |
| | |
| | | materiel_code = json[i].partcode, |
| | | route_code = route_code, |
| | | sourceid = json[i].sourceid == "" ? null : json[i].sourceid, //无源单时赋值NULL |
| | | saleOrderCode=json[i].saleordercode, |
| | | m_po = json[i].sourcewo, |
| | | saleOrderDeliveryDate = json[i].deliverydate, |
| | | plan_startdate = json[i].paystartdate, |
| | |
| | | |
| | | |
| | | #region[生产开报工扫码获取工单对应工序任务(自制)] |
| | | public static ToMessage MesOrderStepSearch(string wkshopcode, string wocode, string partcode, string partname, string partspec, int startNum, int endNum, string prop, string order) |
| | | public static ToMessage MesOrderStepSearch(string wkshopcode, string wocode,string orderno, string partcode, string partname, string partspec, int startNum, int endNum, string prop, string order) |
| | | { |
| | | var sql = ""; |
| | | string search = ""; |
| | |
| | | } |
| | | } |
| | | } |
| | | if (orderno != "" && orderno != null) |
| | | { |
| | | search += "and B.m_po like '%'+@orderno+'%' "; |
| | | dynamicParams.Add("@orderno", orderno); |
| | | } |
| | | if (partcode != "" && partcode != null) |
| | | { |
| | | search += "and M.partcode like '%'+@partcode+'%' "; |
| | |
| | | dynamicParams.Add("@partspec", partspec); |
| | | } |
| | | //根据条件查询工单工序任务(自制工序) |
| | | sql = @"select A.id,A.status,B.wkshp_code,T.torg_name as wkshp_name,A.wo_code,M.partcode,M.partname,M.partspec,A.seq,A.isbott,A.isend, |
| | | sql = @"select A.id,A.status,B.wkshp_code,T.torg_name as wkshp_name,A.wo_code,B.m_po,M.partcode,M.partname,M.partspec,A.seq,A.isbott,A.isend, |
| | | S.stepcode,S.stepname,S.descr,A.plan_quantity,A.plan_qty,A.good_qty,A.ng_qty,A.laborbad_qty,A.materielbad_qty,B.lm_date, |
| | | M.priuserdefnvc1,M.priuserdefnvc2,M.priuserdefnvc3,M.priuserdefnvc4,M.priuserdefnvc5,M.priuserdefnvc6 |
| | | from TK_Wrk_Step A |
| | |
| | | #endregion |
| | | |
| | | #region[生产开报工扫码获取工单对应工序任务(外协)] |
| | | public static ToMessage MesOrderWxStepSearch(string wkshopcode, string wocode, string partcode, string partname, string partspec, int startNum, int endNum, string prop, string order) |
| | | public static ToMessage MesOrderWxStepSearch(string wkshopcode, string wocode, string orderno, string partcode, string partname, string partspec, int startNum, int endNum, string prop, string order) |
| | | { |
| | | var sql = ""; |
| | | string search = ""; |
| | |
| | | } |
| | | } |
| | | } |
| | | if (orderno != "" && orderno != null) |
| | | { |
| | | search += "and B.m_po like '%'+@orderno+'%' "; |
| | | dynamicParams.Add("@orderno", orderno); |
| | | } |
| | | if (partcode != "" && partcode != null) |
| | | { |
| | | search += "and M.partcode like '%'+@partcode+'%' "; |
| | |
| | | dynamicParams.Add("@partspec", partspec); |
| | | } |
| | | //根据条件查询工单工序任务(自制工序) |
| | | sql = @"select A.id,A.status,B.wkshp_code,T.torg_name as wkshp_name,A.wo_code,M.partcode,M.partname,M.partspec,A.seq,A.isbott,A.isend, |
| | | sql = @"select A.id,A.status,B.wkshp_code,T.torg_name as wkshp_name,A.wo_code,B.m_po,M.partcode,M.partname,M.partspec,A.seq,A.isbott,A.isend, |
| | | S.stepcode,S.stepname,S.descr,A.plan_quantity,A.plan_qty,A.good_qty,A.ng_qty, |
| | | (select isnull(sum(fqty),0) as fqty from TK_Wrk_OutRecord where wo_code=A.wo_code and step_code=A.step_code and style='F') as fqty, |
| | | A.laborbad_qty,A.materielbad_qty,A.plan_startdate,A.plan_enddate,B.lm_date, |
| | |
| | | #endregion |
| | | |
| | | #region[生产开报工扫码获取工单对应工序任务(不良)] |
| | | public static ToMessage MesOrderNgStepSearch(string wkshopcode, string wocode, string partcode, string partname, string partspec, int startNum, int endNum, string prop, string order) |
| | | public static ToMessage MesOrderNgStepSearch(string wkshopcode, string wocode, string orderno, string partcode, string partname, string partspec, int startNum, int endNum, string prop, string order) |
| | | { |
| | | var sql = ""; |
| | | string search = ""; |
| | |
| | | return mes; |
| | | } |
| | | } |
| | | if (orderno != "" && orderno != null) |
| | | { |
| | | search += "and B.m_po like '%'+@orderno+'%' "; |
| | | dynamicParams.Add("@orderno", orderno); |
| | | } |
| | | if (partcode != "" && partcode != null) |
| | | { |
| | | search += "and M.partcode like '%'+@partcode+'%' "; |
| | |
| | | dynamicParams.Add("@partspec", partspec); |
| | | } |
| | | //根据条件查询工单工序任务(自制工序) |
| | | sql = @"select A.id,B.wkshp_code,T.torg_name as wkshp_name,A.wo_code,M.partcode,M.partname,M.partspec,A.seq,A.isend, |
| | | sql = @"select A.id,B.wkshp_code,T.torg_name as wkshp_name,A.wo_code,B.m_po,M.partcode,M.partname,M.partspec,A.seq,A.isend, |
| | | S.stepcode,S.stepname,S.descr,A.plan_quantity,A.plan_qty,A.good_qty,A.ng_qty,A.laborbad_qty,A.materielbad_qty,B.lm_date, |
| | | M.priuserdefnvc1,M.priuserdefnvc2,M.priuserdefnvc3,M.priuserdefnvc4,M.priuserdefnvc5,M.priuserdefnvc6 |
| | | from TK_Wrk_Step A |
| | |
| | | |
| | | |
| | | #region[生产执行,报工调整数据查询接口] |
| | | public static ToMessage MesOrderStepVerifySearch(string wkshopcode, string wo_code, string partnumber, string partname, string partspec, string reportuser, string reportdateopendate, string reportdateclosedate, int startNum, int endNum, string prop, string order) |
| | | public static ToMessage MesOrderStepVerifySearch(string wkshopcode, string wo_code,string orderno, string partnumber, string partname, string partspec,string stepcode, string reportuser, string reportdateopendate, string reportdateclosedate, int startNum, int endNum, string prop, string order) |
| | | { |
| | | var dynamicParams = new DynamicParameters(); |
| | | string search = ""; |
| | |
| | | search += "and AA.wo_code like '%'+@wo_code+'%' "; |
| | | dynamicParams.Add("@wo_code", wo_code); |
| | | } |
| | | if (orderno != "" && orderno != null) |
| | | { |
| | | search += "and AA.m_po like '%'+@orderno+'%' "; |
| | | dynamicParams.Add("@orderno", orderno); |
| | | } |
| | | if (partnumber != "" && partnumber != null) |
| | | { |
| | | search += "and AA.partnumber like '%'+@partnumber+'%' "; |
| | |
| | | { |
| | | search += "and AA.partspec like '%'+@partspec+'%' "; |
| | | dynamicParams.Add("@partspec", partspec); |
| | | } |
| | | if (stepcode != "" && stepcode != null) |
| | | { |
| | | search += "and AA.step_code=@stepcode "; |
| | | dynamicParams.Add("@stepcode", stepcode); |
| | | } |
| | | if (reportuser != "" && reportuser != null) |
| | | { |
| | |
| | | // --------------查询指定自制报工外协收料数据-------------- |
| | | var total = 0; //总条数 |
| | | var sql = @"select * from( |
| | | select A.id,B.id as sbid,A.wo_code,A.materiel_code as partnumber,P.partname,P.partspec,K.plan_quantity,K.plan_qty as task_qty,M.wkshp_code,T.torg_name as wkshp_name,A.eqp_code,E.name as eqp_name, |
| | | A.step_seq,A.step_code,S.stepname,S.flwtype as steptype,k.isbott as first_choke,k.isend as last_choke,A.step_price,B.reckway,B.usergroup_code,G.usergroupname as usergroup_name, |
| | | select A.id,B.id as sbid,A.wo_code,M.m_po,A.materiel_code as partnumber,P.partname,P.partspec,K.plan_quantity,K.plan_qty as task_qty,M.wkshp_code,T.torg_name as wkshp_name,A.eqp_code,E.name as eqp_name, |
| | | A.step_seq,A.step_code,S.stepname,S.flwtype as steptype,A.style,k.isbott as first_choke,k.isend as last_choke,A.step_price,B.reckway,B.usergroup_code,G.usergroupname as usergroup_name, |
| | | B.report_person as usercode, |
| | | STUFF((SELECT ',' + U.username |
| | | FROM TUser U |
| | |
| | | left join TGroup G on G.usergroupcode=B.usergroup_code |
| | | where A.style='B' and B.style='B' and M.status<>'CLOSED' and A.verify='N' |
| | | union all |
| | | select A.id,B.id as sbid,A.wo_code,A.materiel_code as partnumber,P.partname,P.partspec,K.plan_quantity,K.plan_qty as task_qty,M.wkshp_code,T.torg_name as wkshp_name,A.wx_code as eqp_code,E.name as eqp_name, |
| | | A.step_seq,A.step_code,S.stepname,S.flwtype as steptype,k.isbott as first_choke,k.isend as last_choke,A.step_price,'person' as reckway,'' as usergroup_code,'' as usergroup_name, |
| | | select A.id,B.id as sbid,A.wo_code,M.m_po,A.materiel_code as partnumber,P.partname,P.partspec,K.plan_quantity,K.plan_qty as task_qty,M.wkshp_code,T.torg_name as wkshp_name,A.wx_code as eqp_code,E.name as eqp_name, |
| | | A.step_seq,A.step_code,S.stepname,S.flwtype as steptype,A.style,k.isbott as first_choke,k.isend as last_choke,A.step_price,'person' as reckway,'' as usergroup_code,'' as usergroup_name, |
| | | B.in_person as usercode, |
| | | STUFF((SELECT ',' + U.username |
| | | FROM TUser U |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region[生产执行,报工调整批量改价数据提交] |
| | | public static ToMessage MesOrderStepPriceBatchUpdateSeave(User us, List<BatchPrice> json) |
| | | { |
| | | string sql = ""; |
| | | List<object> list = new List<object>(); |
| | | var dynamicParams = new DynamicParameters(); |
| | | try |
| | | { |
| | | if (json.Count > 0) |
| | | { |
| | | // 使用Lambda表达式判断类型分布:全部报工或者全部收料 |
| | | bool allB = json.All(p => p.type == "B"); |
| | | bool allS = json.All(p => p.type == "S"); |
| | | if (allB)//全部报工 |
| | | { |
| | | //将List<BatchPrice>中的id字段转换为字符串数组 |
| | | string[] idArray = json.Select(bp => bp.id).ToArray(); |
| | | //回写对应的报工记录主表工价 |
| | | sql = @"update TK_Wrk_Record set step_price=@step_price where id in @idArray and style='B'"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | step_price = decimal.Parse(json[0].price), |
| | | idArray = idArray |
| | | } |
| | | }); |
| | | } |
| | | else if (allS)//全部收料 |
| | | { |
| | | //将List<BatchPrice>中的id字段转换为字符串数组 |
| | | string[] idArray = json.Select(bp => bp.id).ToArray(); |
| | | //回写对应的报工记录主表工价 |
| | | sql = @"update TK_Wrk_OutRecord set step_price=@step_price where id in @idArray and style='S'"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | step_price = decimal.Parse(json[0].price), |
| | | idArray = idArray |
| | | } |
| | | }); |
| | | } |
| | | else // 混合情况 |
| | | { |
| | | //将List<BatchPrice>中为报工的id字段转换为字符串数组 |
| | | var bList = json.Where(p => p.type == "B").ToList(); |
| | | string[] idBArray = bList.Select(bp => bp.id).ToArray(); |
| | | //回写对应的报工记录主表工价 |
| | | sql = @"update TK_Wrk_Record set step_price=@step_price where id in @idBArray and style='B'"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | step_price = decimal.Parse(json[0].price), |
| | | idBArray = idBArray |
| | | } |
| | | }); |
| | | //将List<BatchPrice>中为收料的id字段转换为字符串数组 |
| | | var sList = json.Where(p => p.type == "S").ToList(); |
| | | string[] idSArray = sList.Select(bp => bp.id).ToArray(); |
| | | //回写对应的报工记录主表工价 |
| | | sql = @"update TK_Wrk_OutRecord set step_price=@step_price where id in @idSArray and style='S'"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | step_price = decimal.Parse(json[0].price), |
| | | idSArray = idSArray |
| | | } |
| | | }); |
| | | } |
| | | bool aa = DapperHelper.DoTransaction(list); |
| | | if (aa) |
| | | { |
| | | //写入操作记录表 |
| | | LogHelper.DbOperateLog(us.usercode, "批量修改工价", "报工ID:" + string.Join(",",json.Select(bp => bp.id).ToArray())+",操作类型:"+ string.Join(",", json.Select(bp => bp.type).ToArray()), us.usertype); |
| | | mes.code = "200"; |
| | | mes.count = 0; |
| | | mes.message = "操作成功!"; |
| | | mes.data = null; |
| | | } |
| | | else |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = "操作失败!"; |
| | | mes.data = null; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = "请选择需要批量调整工价的报工记录!"; |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | return mes; |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | throw; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | |
| | | #region[生产执行,报工审核列表数据查询接口] |
| | | public static ToMessage MesOrderStepReportVerifySearch(string reviewstatus, string wkshopcode, string wo_code, string partnumber, string partname, string partspec, string stepname, string reportuser, string reportdateopendate, string reportdateclosedate, int startNum, int endNum, string prop, string order) |
| | | public static ToMessage MesOrderStepReportVerifySearch(string reviewstatus, string wkshopcode, string wo_code, string orderno, string partnumber, string partname, string partspec, string stepname, string reportuser, string reportdateopendate, string reportdateclosedate, int startNum, int endNum, string prop, string order) |
| | | { |
| | | var dynamicParams = new DynamicParameters(); |
| | | string search = ""; |
| | |
| | | { |
| | | search += "and AA.wo_code like '%'+@wo_code+'%' "; |
| | | dynamicParams.Add("@wo_code", wo_code); |
| | | } |
| | | if (orderno != "" && orderno != null) |
| | | { |
| | | search += "and AA.m_po like '%'+@orderno+'%' "; |
| | | dynamicParams.Add("@orderno", orderno); |
| | | } |
| | | if (partnumber != "" && partnumber != null) |
| | | { |
| | |
| | | // --------------查询指定自制报工外协收料数据-------------- |
| | | var total = 0; //总条数 |
| | | var sql = @"select * from( |
| | | select A.id,B.id as sbid,A.wo_code,A.materiel_code as partnumber,P.partname,P.partspec,K.plan_quantity,K.plan_qty as task_qty,M.wkshp_code,T.torg_name as wkshp_name,A.eqp_code,E.name as eqp_name, |
| | | select A.id,B.id as sbid,A.wo_code,M.m_po,A.materiel_code as partnumber,P.partname,P.partspec,K.plan_quantity,K.plan_qty as task_qty,M.wkshp_code,T.torg_name as wkshp_name,A.eqp_code,E.name as eqp_name, |
| | | A.step_seq,A.step_code,S.stepname,S.flwtype as steptype,k.isbott as first_choke,k.isend as last_choke,A.step_price,B.reckway,B.usergroup_code,G.usergroupname as usergroup_name, |
| | | B.report_person as usercode, |
| | | STUFF((SELECT ',' + U.username |
| | |
| | | left join TGroup G on G.usergroupcode=B.usergroup_code |
| | | where A.style='B' and B.style='B' and M.status<>'CLOSED' |
| | | union all |
| | | select A.id,B.id as sbid,A.wo_code,A.materiel_code as partnumber,P.partname,P.partspec,K.plan_quantity,K.plan_qty as task_qty,M.wkshp_code,T.torg_name as wkshp_name,A.wx_code as eqp_code,E.name as eqp_name, |
| | | select A.id,B.id as sbid,A.wo_code,M.m_po,A.materiel_code as partnumber,P.partname,P.partspec,K.plan_quantity,K.plan_qty as task_qty,M.wkshp_code,T.torg_name as wkshp_name,A.wx_code as eqp_code,E.name as eqp_name, |
| | | A.step_seq,A.step_code,S.stepname,S.flwtype as steptype,k.isbott as first_choke,k.isend as last_choke,A.step_price,'person' as reckway,'' as usergroup_code,'' as usergroup_name, |
| | | B.in_person as usercode, |
| | | STUFF((SELECT ',' + U.username |
| | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | #region[生产入库条码补打] |
| | | public static ToMessage ProductInHouseLabCode(string ordercode) |
| | | { |
| | |
| | | #endregion |
| | | |
| | | #region[生产入库信息查询] |
| | | public static ToMessage ProductInHouseOrderSearch(string deptno, string saleordercode, string wkshopcode, string erpordercode, string mesordercode, string partcode, string partname, string partspec) |
| | | public static ToMessage ProductInHouseOrderSearch(string issouceorder, string deptno, string saleordercode, string wkshopcode, string erpordercode, string mesordercode, string partcode, string partname, string partspec) |
| | | { |
| | | var dynamicParams = new DynamicParameters(); |
| | | string search = ""; |
| | | try |
| | | { |
| | | if (issouceorder != "" && issouceorder != null) |
| | | { |
| | | switch (issouceorder) |
| | | { |
| | | case "Y": |
| | | search += " and AA.m_po<>'' "; |
| | | break; |
| | | case "N": |
| | | search += " and AA.m_po='' "; |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | if (deptno != "" && deptno != null) |
| | | { |
| | | search += "and AA.dept_code=@deptno "; |
| | |
| | | var sql = @"select * from( |
| | | select A.inbarcode,E.saleOrderid,isnull(E.saleOrderCode,'') as saleOrderCode,E.saleOrderDetailId,E.woid as mpoid,M.m_po,E.sbid,M.id as wo_id,A.wo_code,E.materiel_id,P.partcode,P.partname,P.partspec,E.unitid,E.unitcode,E.unitname, |
| | | A.step_code,T.stepname,M.wkshp_code,O.torg_name as wkshp_name,COALESCE(K.noid, E.stck_id) as stockid,COALESCE(K.code, E.stck_code) as stockcode,k.name as stockname,E.dept_id,E.dept_code, |
| | | E.saleOrderqty,E.qty,M.plan_qty,A.good_qty,isnull(A.inhouseqty,0) as inhouseqty,A.good_qty-isnull(A.inhouseqty,0) as stinhouseqty,M.lm_date,A.style,E.voucherdate |
| | | E.saleOrderqty,E.qty,M.plan_qty,A.good_qty,isnull(A.inhouseqty,0) as inhouseqty,A.good_qty-isnull(A.inhouseqty,0) as stinhouseqty,M.lm_date,A.style, |
| | | (case when E.voucherdate is null then M.lm_date else E.voucherdate end) as voucherdate |
| | | from TK_Wrk_Record A |
| | | 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 |
| | |
| | | union all |
| | | select A.inbarcode,E.saleOrderid,isnull(E.saleOrderCode,'') as saleOrderCode,E.saleOrderDetailId,E.woid as mpoid,M.m_po,E.sbid,M.id as wo_id,A.wo_code,E.materiel_id,P.partcode,P.partname,P.partspec,E.unitid,E.unitcode,E.unitname, |
| | | A.step_code,T.stepname,M.wkshp_code,O.torg_name as wkshp_name,COALESCE(K.noid, E.stck_id) as stockid,COALESCE(K.code, E.stck_code) as stockcode,k.name as stockname,E.dept_id,E.dept_code, |
| | | E.saleOrderqty,E.qty,M.plan_qty,A.sqty as sqty,isnull(A.inhouseqty,0) as inhouseqty,A.sqty-isnull(A.inhouseqty,0) as stinhouseqty,M.lm_date,A.style,E.voucherdate |
| | | E.saleOrderqty,E.qty,M.plan_qty,A.sqty as sqty,isnull(A.inhouseqty,0) as inhouseqty,A.sqty-isnull(A.inhouseqty,0) as stinhouseqty,M.lm_date,A.style, |
| | | (case when E.voucherdate is null then M.lm_date else E.voucherdate end) as voucherdate |
| | | from TK_Wrk_OutRecord A |
| | | 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 |