| | |
| | | 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, |
| | |
| | | hpartcode = json[i].hpartcode, |
| | | hplanqty = decimal.Parse(json[i].hplanqty), |
| | | hqty = decimal.Parse(json[i].hqty), |
| | | hacceptdate = Convert.ToDateTime(hacceptdate), |
| | | hacceptdate = hacceptdate == "" ? null : hacceptdate, |
| | | hischeck = json[i].hischeck, |
| | | hbatchno = json[i].hbatchno |
| | | } |