1.ERP订单、MES工单列表新增顶级物料编码、顶级物料名称
2.ERP订单派发接口增加顶级物料id、顶级物料编码、顶级物料名称
| | |
| | | string markqty = obj["markqty"].ToString(); //下单数量 |
| | | string ordernum = obj["ordernum"].ToString(); //下单单数 |
| | | string relse_qty = obj["relse_qty"].ToString(); //已下单数量 |
| | | string idTopInventory = obj["idTopInventory"].ToString(); //顶级物料id |
| | | string TopInventoryCode = obj["TopInventoryCode"].ToString(); //顶级物料编码 |
| | | string TopInventoryName = obj["TopInventoryName"].ToString(); //顶级物料名称 |
| | | string saleOrderDeliveryDate = obj["saleOrderDeliveryDate"].ToString(); //交付时间 |
| | | mes = WorkOrderBLL.MarkSaveErpOrder(erporderid, sbid, erpordercode, saleordercode, partcode, wkshopcode, warehousecode, erpqty, markqty, ordernum, relse_qty, saleOrderDeliveryDate,us); |
| | | mes = WorkOrderBLL.MarkSaveErpOrder(erporderid, sbid, erpordercode, saleordercode, partcode, wkshopcode, warehousecode, erpqty, markqty, ordernum, relse_qty, saleOrderDeliveryDate, idTopInventory, TopInventoryCode, TopInventoryName, us); |
| | | return Json(mes); |
| | | } |
| | | #endregion |
| | |
| | | #endregion |
| | | |
| | | #region[ERP订单下达] |
| | | public static ToMessage MarkSaveErpOrder(string erporderid,string sbid, string erpordercode, string saleordercode, string partcode, string wkshopcode, string warehousecode, string erpqty, string markqty, string ordernum, string relse_qty, string saleOrderDeliveryDate, User us) |
| | | public static ToMessage MarkSaveErpOrder(string erporderid,string sbid, string erpordercode, string saleordercode, string partcode, string wkshopcode, string warehousecode, string erpqty, string markqty, string ordernum, string relse_qty, string saleOrderDeliveryDate,string idTopInventory,string TopInventoryCode,string TopInventoryName, User us) |
| | | { |
| | | return WorkOrderDAL.MarkSaveErpOrder(erporderid, sbid, erpordercode, saleordercode, partcode, wkshopcode, warehousecode, erpqty, markqty, ordernum, relse_qty, saleOrderDeliveryDate, us); |
| | | return WorkOrderDAL.MarkSaveErpOrder(erporderid, sbid, erpordercode, saleordercode, partcode, wkshopcode, warehousecode, erpqty, markqty, ordernum, relse_qty, saleOrderDeliveryDate, idTopInventory, TopInventoryCode, TopInventoryName, us); |
| | | } |
| | | #endregion |
| | | |
| | |
| | | } |
| | | // --------------查询指定数据-------------- |
| | | var total = 0; //总条数 |
| | | var sql = @"select A.id, A.status,A.wo,A.materiel_code as partcode,B.partname,B.partspec,A.qty,A.relse_qty,A.wkshp_code,C.torg_name as wkshp_name, |
| | | var sql = @"select A.id, A.status,A.wo,A.materiel_code as partcode,B.partname,B.partspec,A.idTopInventory,A.TopInventoryCode,A.TopInventoryName,A.qty,A.relse_qty,A.wkshp_code,C.torg_name as wkshp_name, |
| | | A.stck_code,D.name as stck_name,A.saleOrderCode,A.saleOrderDeliveryDate,A.planstartdate,A.planenddate,U.username as createuser,A.createdate,A.sbid |
| | | from TKimp_Ewo A |
| | | left join TMateriel_Info B on A.materiel_code=B.partcode |
| | |
| | | #endregion |
| | | |
| | | #region[ERP订单下达] |
| | | public static ToMessage MarkSaveErpOrder(string erporderid, string sbid, string erpordercode, string saleordercode, string partcode, string wkshopcode, string warehousecode, string erpqty, string markqty, string ordernum, string relse_qty, string saleOrderDeliveryDate, User us) |
| | | public static ToMessage MarkSaveErpOrder(string erporderid, string sbid, string erpordercode, string saleordercode, string partcode, string wkshopcode, string warehousecode, string erpqty, string markqty, string ordernum, string relse_qty, string saleOrderDeliveryDate,string idTopInventory,string TopInventoryCode,string TopInventoryName, User us) |
| | | { |
| | | var sql = ""; |
| | | List<object> list = new List<object>(); |
| | |
| | | } |
| | | if (i == Convert.ToInt32(ordernum)) //最后一单时 |
| | | { |
| | | sql = @"insert into TK_Wrk_Man(wo_code,wotype,status,wkshp_code,plan_qty,stck_code,sbid,materiel_code,sourceid,m_po,lm_user,lm_date,saleOrderCode,saleOrderDeliveryDate,data_sources,isstep) values(@wo_code,@wotype,@status,@wkshp_code,@plan_qty,@stck_code,@sbid,@materiel_code,@sourceid,@m_po,@username,@CreateDate,@saleOrderCode,@saleOrderDeliveryDate,@data_sources,@isstep)"; |
| | | sql = @"insert into TK_Wrk_Man(wo_code,wotype,status,wkshp_code,plan_qty,stck_code,sbid,materiel_code,sourceid,m_po,lm_user,lm_date,saleOrderCode,saleOrderDeliveryDate,data_sources,isstep,idTopInventory,TopInventoryCode,TopInventoryName) |
| | | values(@wo_code,@wotype,@status,@wkshp_code,@plan_qty,@stck_code,@sbid,@materiel_code,@sourceid,@m_po,@username,@CreateDate,@saleOrderCode,@saleOrderDeliveryDate,@data_sources,@isstep,@idTopInventory,@TopInventoryCode,@TopInventoryName)"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | |
| | | saleOrderCode = saleordercode, |
| | | saleOrderDeliveryDate = Convert.ToDateTime(saleOrderDeliveryDate), |
| | | data_sources = "ERP", |
| | | isstep = "N" //是否关联工序 |
| | | isstep = "N", //是否关联工序 |
| | | idTopInventory=idTopInventory, |
| | | TopInventoryCode=TopInventoryCode, |
| | | TopInventoryName=TopInventoryName |
| | | } |
| | | }); |
| | | sumqty = sumqty + (decimal.Parse(markqty) - sumqty); |
| | |
| | | else |
| | | { |
| | | |
| | | sql = @"insert into TK_Wrk_Man(wo_code,wotype,status,wkshp_code,plan_qty,stck_code,sbid,materiel_code,sourceid,m_po,lm_user,lm_date,saleOrderCode,saleOrderDeliveryDate,data_sources,isstep) values(@wo_code,@wotype,@status,@wkshp_code,@plan_qty,@stck_code,@sbid,@materiel_code,@sourceid,@m_po,@username,@CreateDate,@saleOrderCode,@saleOrderDeliveryDate,@data_sources,@isstep)"; |
| | | sql = @"insert into TK_Wrk_Man(wo_code,wotype,status,wkshp_code,plan_qty,stck_code,sbid,materiel_code,sourceid,m_po,lm_user,lm_date,saleOrderCode,saleOrderDeliveryDate,data_sources,isstep,idTopInventory,TopInventoryCode,TopInventoryName) |
| | | values(@wo_code,@wotype,@status,@wkshp_code,@plan_qty,@stck_code,@sbid,@materiel_code,@sourceid,@m_po,@username,@CreateDate,@saleOrderCode,@saleOrderDeliveryDate,@data_sources,@isstep,@idTopInventory,@TopInventoryCode,@TopInventoryName)"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | |
| | | saleOrderCode = saleordercode, |
| | | saleOrderDeliveryDate = Convert.ToDateTime(saleOrderDeliveryDate), |
| | | data_sources = "ERP", |
| | | isstep = "N"//是否关联工序 |
| | | isstep = "N",//是否关联工序 |
| | | idTopInventory = idTopInventory, |
| | | TopInventoryCode = TopInventoryCode, |
| | | TopInventoryName = TopInventoryName |
| | | } |
| | | }); |
| | | } |
| | |
| | | string wo = model.erpordercode + "_" + (num + count); |
| | | result += wo.ToString() + ","; |
| | | //写入工单表 |
| | | sql = @"insert into TK_Wrk_Man(wo_code,wotype,status,wkshp_code,plan_qty,stck_code,sbid,materiel_code,sourceid,m_po,lm_user,lm_date,saleOrderCode,saleOrderDeliveryDate,data_sources,isstep) values(@wo_code,@wotype,@status,@wkshp_code,@plan_qty,@stck_code,@sbid,@materiel_code,@sourceid,@m_po,@username,@CreateDate,@saleOrderCode,@saleOrderDeliveryDate,@data_sources,@isstep)"; |
| | | sql = @"insert into TK_Wrk_Man(wo_code,wotype,status,wkshp_code,plan_qty,stck_code,sbid,materiel_code,sourceid,m_po,lm_user,lm_date,saleOrderCode,saleOrderDeliveryDate,data_sources,isstep,idTopInventory,TopInventoryCode,TopInventoryName) |
| | | values(@wo_code,@wotype,@status,@wkshp_code,@plan_qty,@stck_code,@sbid,@materiel_code,@sourceid,@m_po,@username,@CreateDate,@saleOrderCode,@saleOrderDeliveryDate,@data_sources,@isstep,@idTopInventory,@TopInventoryCode,@TopInventoryName)"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | |
| | | saleOrderCode = model.saleordercode, |
| | | saleOrderDeliveryDate = Convert.ToDateTime(model.saleOrderDeliveryDate), |
| | | data_sources = "ERP", |
| | | isstep = "N" //是否关联工序 |
| | | isstep = "N", //是否关联工序 |
| | | idTopInventory = model.idTopInventory, |
| | | TopInventoryCode = model.TopInventoryCode, |
| | | TopInventoryName = model.TopInventoryName |
| | | } |
| | | }); |
| | | |
| | |
| | | } |
| | | 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.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 |
| | | 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,A.saleOrderCode,U.username as lm_user,A.lm_date,A.data_sources,A.isstep |
| | | 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 |
| | | left join TMateriel_Info B on A.materiel_code=B.partcode |
| | |
| | | } |
| | | if (saleordercode != "" && saleordercode != null) |
| | | { |
| | | search += "and W.saleOrderCode like '%'+@saleordercode+'%' "; |
| | | search += "and A.saleOrderCode like '%'+@saleordercode+'%' "; |
| | | dynamicParams.Add("@saleordercode", saleordercode); |
| | | } |
| | | if (partcode != "" && partcode != 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.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 |
| | | 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,A.saleOrderCode,U.username as lm_user,A.lm_date,S.laborbad_qty,S.materielbad_qty |
| | | 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 |
| | | left join (select wo_code,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty from TK_Wrk_Step where (laborbad_qty+materielbad_qty)>0 group by wo_code) S on A.wo_code=S.wo_code |
| | |
| | | if (operType == "Add") |
| | | { |
| | | //写入工单表 |
| | | sql = @"insert into TK_Wrk_Man(wo_code,wotype,status,wkshp_code,plan_qty,lm_user,lm_date,materiel_code,sourceid,m_po,saleOrderDeliveryDate,piroque,isaps,data_sources,isstep) |
| | | values(@wo_code,@wotype,@status,@wkshp_code,@plan_qty,@lm_user,@lm_date,@materiel_code,@sourceid,@m_po,@saleOrderDeliveryDate,@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,sourceid,m_po,saleOrderCode,saleOrderDeliveryDate,piroque,isaps,data_sources,isstep) |
| | | values(@wo_code,@wotype,@status,@wkshp_code,@plan_qty,@lm_user,@lm_date,@materiel_code,@sourceid,@m_po,@saleOrderCode,@saleOrderDeliveryDate,@orderlev,@isaps,@data_sources,@isstep)"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | |
| | | materiel_code = json.partcode, |
| | | sourceid = json.sourceid == "" ? null : json.sourceid, //无源单时赋值NULL |
| | | m_po = json.sourcewo, |
| | | saleOrderCode=json.saleordercode, |
| | | saleOrderDeliveryDate = json.deliverydate, |
| | | orderlev = "3",//优先级:特级(1) 紧急(2) 正常(3) |
| | | isaps = "N", //是否排产,默认N Y=是 N=否 |
| | |
| | | { |
| | | //修改工单表 |
| | | 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,sourceid=@sourceid,m_po=@m_po,saleOrderDeliveryDate=@saleOrderDeliveryDate,isstep=@isstep |
| | | materiel_code=@materiel_code,sourceid=@sourceid,m_po=@m_po,saleOrderCode=@saleOrderCode,saleOrderDeliveryDate=@saleOrderDeliveryDate,isstep=@isstep |
| | | where wo_code=@wo_code"; |
| | | list.Add(new |
| | | { |
| | |
| | | materiel_code = json.partcode, |
| | | sourceid = json.sourceid == "" ? null : json.sourceid, //无源单时赋值NULL |
| | | m_po = json.sourcewo, |
| | | saleOrderCode=json.saleordercode, |
| | | saleOrderDeliveryDate = json.deliverydate, |
| | | lm_user = us.usercode, |
| | | lm_date = DateTime.Now.ToString(), |
| | |
| | | /// 交付时间 |
| | | /// </summary> |
| | | public string saleOrderDeliveryDate { get; set; } |
| | | /// <summary> |
| | | /// 顶级物料编id |
| | | /// </summary> |
| | | public string idTopInventory { get; set; } |
| | | /// <summary> |
| | | /// 顶级物料编码 |
| | | /// </summary> |
| | | public string TopInventoryCode { get; set; } |
| | | /// <summary> |
| | | /// 顶级物料名称 |
| | | /// </summary> |
| | | public string TopInventoryName { get; set; } |
| | | } |
| | | } |
| | |
| | | /// 是否关联工序 |
| | | /// </summary> |
| | | public string isstep { get; set; } |
| | | /// <summary> |
| | | /// 销售订单号 |
| | | /// </summary> |
| | | public string saleordercode { get; set; } |
| | | public List<WorkListSub> WorkListSub { get; set; } |
| | | } |
| | | public class WorkListSub |