| | |
| | | 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='S' and S.isend='Y' and A.sqty>0 |
| | | ) as AA where 1=1 " + search; |
| | | ) as AA where AA.good_qty>AA.inhouseqty " + search; |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | mes.code = "200"; |
| | | mes.Message = "查询成功!"; |
| | |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | labcode=sub_arra[i]["inbarcode"].ToString(), |
| | | labcode = sub_arra[i]["inbarcode"].ToString(), |
| | | materiel_code = sub_arra[i]["partcode"].ToString(), |
| | | storehouse_code = sub_arra[i]["stockcode"].ToString(), |
| | | qty =decimal.Parse(sub_arra[i]["stinhouseqty"].ToString()), |
| | | qty = decimal.Parse(sub_arra[i]["stinhouseqty"].ToString()), |
| | | lm_user = username, |
| | | lm_date = DateTime.Now.ToString() |
| | | } |
| | |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | docu_typecode="1202", |
| | | hbillno= obj["head"]["hbillno"].ToString(), |
| | | hsoucenillnoid= obj["head"]["sourceVoucherId"].ToString(), |
| | | docu_typecode = "1202", |
| | | hbillno = obj["head"]["hbillno"].ToString(), |
| | | hsoucenillnoid = obj["head"]["sourceVoucherId"].ToString(), |
| | | hsoucenillno = obj["head"]["sourceVoucherCode"].ToString(), |
| | | saleorderid = obj["head"]["saleOrderId"].ToString(), |
| | | saleordercode = obj["head"]["saleOrderCode"].ToString(), |
| | | status = "NEW", |
| | | wkshpcode = obj["head"]["wkshpcode"].ToString(), |
| | | lm_user = username, |
| | | lm_date= DateTime.Now.ToString() |
| | | lm_date = DateTime.Now.ToString() |
| | | } |
| | | }); |
| | | |
| | | //获取ERP入库表sql |
| | | DataTable dt = DapperHelper.lissql("h_p_MesInErpProductWareHous"); |
| | | //DataTable dt = DapperHelper.lissql("h_p_MesInErpProductWareHous"); |
| | | //写入ERP入库记录主表 |
| | | sql = @"" + dt.Rows[0]["cname"].ToString() + ""; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | code = obj["head"]["hbillno"].ToString(), |
| | | sourceVoucherId = obj["head"]["sourceVoucherId"].ToString(), |
| | | sourceVoucherCode = obj["head"]["sourceVoucherCode"].ToString(), |
| | | saleOrderId = obj["head"]["saleOrderId"].ToString(), |
| | | saleOrderCode = obj["head"]["saleOrderCode"].ToString(), |
| | | rdDirectionFlag = obj["head"]["rdDirectionFlag"].ToString(), |
| | | makerid = obj["head"]["makerid"].ToString(), |
| | | maker = obj["head"]["maker"].ToString(), |
| | | accountingyear = obj["head"]["accountingyear"].ToString(), |
| | | VoucherYear = obj["head"]["VoucherYear"].ToString(), |
| | | VoucherPeriod = obj["head"]["VoucherPeriod"].ToString(), |
| | | ManufactureOrderCode = obj["head"]["ManufactureOrderCode"].ToString(), |
| | | idbusitype = obj["head"]["idbusitype"].ToString(), |
| | | iddepartment = obj["head"]["iddepartment"].ToString(), |
| | | idrdstyle = obj["head"]["idrdstyle"].ToString(), |
| | | idwarehouse = obj["head"]["idwarehouse"].ToString(), |
| | | voucherState = obj["head"]["voucherState"].ToString(), |
| | | idvouchertype = obj["head"]["idvouchertype"].ToString(), |
| | | voucherdate = obj["head"]["voucherdate"].ToString(), |
| | | madedate = obj["head"]["madedate"].ToString(), |
| | | createdtime = obj["head"]["createdtime"].ToString(), |
| | | DataSource = obj["head"]["DataSource"].ToString(), |
| | | //sql = @"" + dt.Rows[0]["cname"].ToString() + ""; |
| | | //list.Add(new |
| | | //{ |
| | | // str = sql, |
| | | // parm = new |
| | | // { |
| | | // code = obj["head"]["hbillno"].ToString(), |
| | | // sourceVoucherId = obj["head"]["sourceVoucherId"].ToString(), |
| | | // sourceVoucherCode = obj["head"]["sourceVoucherCode"].ToString(), |
| | | // saleOrderId = obj["head"]["saleOrderId"].ToString(), |
| | | // saleOrderCode = obj["head"]["saleOrderCode"].ToString(), |
| | | // rdDirectionFlag = obj["head"]["rdDirectionFlag"].ToString(), |
| | | // makerid = obj["head"]["makerid"].ToString(), |
| | | // maker = obj["head"]["maker"].ToString(), |
| | | // accountingyear = obj["head"]["accountingyear"].ToString(), |
| | | // VoucherYear = obj["head"]["VoucherYear"].ToString(), |
| | | // VoucherPeriod = obj["head"]["VoucherPeriod"].ToString(), |
| | | // ManufactureOrderCode = obj["head"]["ManufactureOrderCode"].ToString(), |
| | | // idbusitype = obj["head"]["idbusitype"].ToString(), |
| | | // iddepartment = obj["head"]["iddepartment"].ToString(), |
| | | // idrdstyle = obj["head"]["idrdstyle"].ToString(), |
| | | // idwarehouse = obj["head"]["idwarehouse"].ToString(), |
| | | // voucherState = obj["head"]["voucherState"].ToString(), |
| | | // idvouchertype = obj["head"]["idvouchertype"].ToString(), |
| | | // voucherdate = obj["head"]["voucherdate"].ToString(), |
| | | // madedate = obj["head"]["madedate"].ToString(), |
| | | // createdtime = obj["head"]["createdtime"].ToString(), |
| | | // DataSource = obj["head"]["DataSource"].ToString(), |
| | | // idsourcevouchertype= obj["head"]["idsourcevouchertype"].ToString() |
| | | |
| | | } |
| | | }); |
| | | // } |
| | | //}); |
| | | //写入ERP、MES入库记录子表 |
| | | for (int j = 0; j < subsum_arra.Count; j++) |
| | | { |
| | | //写入ERP入库记录子表 |
| | | sql = @"" + dt.Rows[1]["cname"].ToString() + ""; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | code = subsum_arra[j]["code"].ToString(), |
| | | arrivalQuantity = subsum_arra[j]["arrivalQuantity"].ToString(), |
| | | quantity = subsum_arra[j]["quantity"].ToString(), |
| | | compositionQuantity = subsum_arra[j]["compositionQuantity"].ToString(), |
| | | baseQuantity = subsum_arra[j]["baseQuantity"].ToString(), |
| | | sourceVoucherId = subsum_arra[j]["sourceVoucherId"].ToString(), |
| | | sourceVoucherCode = subsum_arra[j]["sourceVoucherCode"].ToString(), |
| | | sourceVoucherDetailId = subsum_arra[j]["sourceVoucherDetailId"].ToString(), |
| | | idsourcevouchertype = subsum_arra[j]["idsourcevouchertype"].ToString(), |
| | | saleOrderId = subsum_arra[j]["saleOrderId"].ToString(), |
| | | saleOrderCode = subsum_arra[j]["saleOrderCode"].ToString(), |
| | | saleOrderDetailId = subsum_arra[j]["saleOrderDetailId"].ToString(), |
| | | ManufactureOrderId = subsum_arra[j]["ManufactureOrderId"].ToString(), |
| | | ManufactureOrderCode = subsum_arra[j]["ManufactureOrderCode"].ToString(), |
| | | ManufactureOrderDetailId = subsum_arra[j]["ManufactureOrderDetailId"].ToString(), |
| | | idbusiTypeByMergedFlow = subsum_arra[j]["idbusiTypeByMergedFlow"].ToString(), |
| | | idinventory = subsum_arra[j]["idinventory"].ToString(), |
| | | idbaseunit = subsum_arra[j]["idbaseunit"].ToString(), |
| | | idunit = subsum_arra[j]["idunit"].ToString(), |
| | | idwarehouse = subsum_arra[j]["idwarehouse"].ToString(), |
| | | SourceVoucherIdByMergedFlow = subsum_arra[j]["SourceVoucherIdByMergedFlow"].ToString(), |
| | | SourceVoucherCodeByMergedFlow = subsum_arra[j]["SourceVoucherCodeByMergedFlow"].ToString(), |
| | | SourceVoucherDetailIdByMergedFlow = subsum_arra[j]["SourceVoucherDetailIdByMergedFlow"].ToString(), |
| | | idsourceVoucherTypeByMergedFlow = subsum_arra[j]["idsourceVoucherTypeByMergedFlow"].ToString(), |
| | | createdtime = subsum_arra[j]["createdtime"].ToString(), |
| | | DataSource = subsum_arra[j]["DataSource"].ToString() |
| | | } |
| | | }); |
| | | //sql = @"" + dt.Rows[1]["cname"].ToString() + ""; |
| | | //list.Add(new |
| | | //{ |
| | | // str = sql, |
| | | // parm = new |
| | | // { |
| | | // code = subsum_arra[j]["code"].ToString(), |
| | | // arrivalQuantity = subsum_arra[j]["arrivalQuantity"].ToString(), |
| | | // quantity = subsum_arra[j]["quantity"].ToString(), |
| | | // compositionQuantity = subsum_arra[j]["compositionQuantity"].ToString(), |
| | | // baseQuantity = subsum_arra[j]["baseQuantity"].ToString(), |
| | | // sourceVoucherId = subsum_arra[j]["sourceVoucherId"].ToString(), |
| | | // sourceVoucherCode = subsum_arra[j]["sourceVoucherCode"].ToString(), |
| | | // sourceVoucherDetailId = subsum_arra[j]["sourceVoucherDetailId"].ToString(), |
| | | // idsourcevouchertype = subsum_arra[j]["idsourcevouchertype"].ToString(), |
| | | // saleOrderId = subsum_arra[j]["saleOrderId"].ToString(), |
| | | // saleOrderCode = subsum_arra[j]["saleOrderCode"].ToString(), |
| | | // saleOrderDetailId = subsum_arra[j]["saleOrderDetailId"].ToString(), |
| | | // ManufactureOrderId = subsum_arra[j]["ManufactureOrderId"].ToString(), |
| | | // ManufactureOrderCode = subsum_arra[j]["ManufactureOrderCode"].ToString(), |
| | | // ManufactureOrderDetailId = subsum_arra[j]["ManufactureOrderDetailId"].ToString(), |
| | | // idbusiTypeByMergedFlow = subsum_arra[j]["idbusiTypeByMergedFlow"].ToString(), |
| | | // idinventory = subsum_arra[j]["idinventory"].ToString(), |
| | | // idbaseunit = subsum_arra[j]["idbaseunit"].ToString(), |
| | | // idunit = subsum_arra[j]["idunit"].ToString(), |
| | | // idwarehouse = subsum_arra[j]["idwarehouse"].ToString(), |
| | | // SourceVoucherIdByMergedFlow = subsum_arra[j]["SourceVoucherIdByMergedFlow"].ToString(), |
| | | // SourceVoucherCodeByMergedFlow = subsum_arra[j]["SourceVoucherCodeByMergedFlow"].ToString(), |
| | | // SourceVoucherDetailIdByMergedFlow = subsum_arra[j]["SourceVoucherDetailIdByMergedFlow"].ToString(), |
| | | // idsourceVoucherTypeByMergedFlow = subsum_arra[j]["idsourceVoucherTypeByMergedFlow"].ToString(), |
| | | // createdtime = subsum_arra[j]["createdtime"].ToString(), |
| | | // DataSource = subsum_arra[j]["DataSource"].ToString() |
| | | // } |
| | | //}); |
| | | //写入ERP现存量查询表 |
| | | //sql = @"" + dt.Rows[2]["cname"].ToString() + ""; |
| | | //list.Add(new |
| | | //{ |
| | | // str = sql, |
| | | // parm = new |
| | | // { |
| | | // idinventory = subsum_arra[j]["idinventory"].ToString(), |
| | | // idwarehouse = subsum_arra[j]["idwarehouse"].ToString(), |
| | | // propertyName = "ProductForReceive", |
| | | // baseQuantity= subsum_arra[j]["quantity"].ToString(), |
| | | // IdMarketingOrgan="1", |
| | | // idbaseunit= subsum_arra[j]["idbaseunit"].ToString(), |
| | | // updated= DateTime.Now.ToString(), |
| | | // isCarriedForwardOut ="0", |
| | | // isCarriedForwardIn = "0" |
| | | // } |
| | | //}); |
| | | |
| | | |
| | | |
| | | //写入MES入库记录子表 |
| | | sql = @"insert into TK_WMS_Inwh_Sub(hbillno,rownumber,materiel_code,storehouse_code,qty) |
| | | values(@hbillno,@rownumber,@materiel_code,@storehouse_code,@qty)"; |