| | |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | //Lambda表达式过滤获取预计到货日期、部门、供应商 |
| | | string hacceptdate = json.Select(p => p.hacceptdate).ToList().Distinct().ToString(); //预计到货日期 |
| | | string dpartment = json.Select(p => p.hdepartmentcode).ToList().Distinct().ToString(); //部门 |
| | | string customercode = json.Select(p => p.hcustomercode).ToList().Distinct().ToString(); //供应商 |
| | | //Lambda表达式过滤获取预计到货日期、部门、供应商取第一个 |
| | | string hacceptdate = json.Select(p => p.hacceptdate).Distinct().ToList().First().ToString(); //预计到货日期 |
| | | string dpartment = json.Select(p => p.hdepartmentcode).Distinct().ToList().First().ToString(); //部门 |
| | | string customercode = json.Select(p => p.hcustomercode).Distinct().ToList().First().ToString(); //供应商 |
| | | //写入采购到货单主表 |
| | | sql = @"insert into T_PurchaseArrivalOrder(hbillno,hdate,hacceptdate,hbillstaus,hdepartmentcode,hcustomercode,hsourcebillno,lm_user,lm_date) |
| | | values(@hbillno,@hdate,@hacceptdate,@hbillstaus,@hdepartmentcode,@hcustomercode,@hsourcebillno,@lm_user,@lm_date)"; |
| | |
| | | { |
| | | hbillno = djwo, |
| | | hdate = DateTime.Now.ToString(), |
| | | hacceptdate = Convert.ToDateTime(hacceptdate), |
| | | hacceptdate =hacceptdate==""?null:hacceptdate, |
| | | hbillstaus = orderstaus, |
| | | hdepartmentcode = dpartment, |
| | | hcustomercode = customercode, |
| | |
| | | for (int i = 0; i < json.Count; i++) |
| | | { |
| | | //写入采购到货单子表 |
| | | sql = @"insert into T_PurchaseArrivalOrder_sub(hbillno,rownumber,hpartcode,hplanqty,hqty,hacceptdate,hischeck,hbatchno) |
| | | values(@hbillno,@hpartcode,@hplanqty,@hqty,@hacceptdate,@hischeck,@hbatchno)"; |
| | | sql = @"insert into T_PurchaseArrivalOrder_sub(hbillno,rownumber,hpartcode,hplanqty,hqty,hacceptdate,hcheckstaus,hbatchno) |
| | | values(@hbillno,@rownumber,@hpartcode,@hplanqty,@hqty,@hacceptdate,@hcheckstaus,@hbatchno)"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | |
| | | hpartcode = json[i].hpartcode, |
| | | hplanqty = decimal.Parse(json[i].hplanqty), |
| | | hqty = decimal.Parse(json[i].hqty), |
| | | hacceptdate = Convert.ToDateTime(hacceptdate), |
| | | hischeck = json[i].hischeck, |
| | | hacceptdate = hacceptdate == "" ? null : hacceptdate, |
| | | hcheckstaus = json[i].hischeck, |
| | | hbatchno = json[i].hbatchno |
| | | } |
| | | }); |
| | |
| | | { |
| | | //写入条码档案表 |
| | | sql = @"insert into T_BarCodeBill(rightcode,hbillno,hbilltype,hbarcode,hbarcodestatus,hbarcodetype,hmaterialcode,hqty,hbatchno,hcustomercode,hdeptcode,hsourcebillno,hsourcebilltype,barcodeposition,lm_user,lm_date) |
| | | values(@rightcode,hbillno,@hbilltype,@hbarcode,@hbarcodestatus,@hbarcodetype,@hmaterialcode,@hqty,@hbatchno,@hcustomercode,@hdeptcode,@hsourcebillno,@hsourcebilltype,@barcodeposition,@lm_user,@lm_date)"; |
| | | values(@rightcode,@hbillno,@hbilltype,@hbarcode,@hbarcodestatus,@hbarcodetype,@hmaterialcode,@hqty,@hbatchno,@hcustomercode,@hdeptcode,@hsourcebillno,@hsourcebilltype,@barcodeposition,@lm_user,@lm_date)"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | |
| | | }); |
| | | } |
| | | //更新采购订单子表:累计到货数量 |
| | | sql = @"update T_PurchaseOrder_sub set countarrivalquantity=countarrivalquantity+@hqty where ordercode=@purordercode and materiel_code=@materiel_code and rownumber=@rownumber"; |
| | | sql = @"update T_PurchaseOrder_sub set countarrivalquantity=countarrivalquantity+@hqty where purchaseorder_code=@purordercode and materiel_code=@materiel_code and rownumber=@rownumber"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | |
| | | }); |
| | | } |
| | | //更新采购订单主表:订单状态 |
| | | sql = @"update T_PurchaseOrder set status=@status where ordercode=@purordercode"; |
| | | sql = @"update T_PurchaseOrder set status=@status where ordercode=@ordercode"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |