纽威
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

515 lines
25 KiB

  1. using ICSSoft.Common;
  2. using ICSSoft.Entity;
  3. using Newtonsoft.Json;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Data;
  7. using System.Data.SqlClient;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. namespace ICSSoft.DataProject
  12. {
  13. /// <summary>
  14. /// 成品入库单
  15. /// </summary>
  16. public class ManufactureReceiveDoc
  17. {
  18. private static log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
  19. private static string connString = System.Configuration.ConfigurationManager.AppSettings["ERPConnStr"];
  20. private static string ERPDB = System.Configuration.ConfigurationManager.AppSettings["ERPDB"];
  21. private static string Type = System.Configuration.ConfigurationManager.AppSettings["Type"];
  22. /// <summary>
  23. /// 获取成品入库单
  24. /// </summary>
  25. /// <param name="infos"></param>
  26. /// <returns></returns>
  27. public string Get(List<ICSManufactureReceiveDoc> infos)
  28. {
  29. List<ICSManufactureReceiveDoc> szJson = new List<ICSManufactureReceiveDoc>();
  30. DataTable dt = null;
  31. string json = "";
  32. if (infos.Count <= 0)
  33. {
  34. throw new Exception("传送数据为空!");
  35. }
  36. string res = string.Empty;
  37. SqlConnection conn = new System.Data.SqlClient.SqlConnection(connString);
  38. conn.Open();
  39. SqlTransaction sqlTran = conn.BeginTransaction();
  40. SqlCommand cmd = new SqlCommand();
  41. cmd.Transaction = sqlTran;
  42. cmd.Connection = conn;
  43. try
  44. {
  45. string sql = string.Empty;
  46. foreach (ICSManufactureReceiveDoc info in infos)
  47. {
  48. if (info.MTime < new DateTime(2000, 01, 01))
  49. throw new Exception("请输入正确的操作时间:" + info.MTime);
  50. sql = @" select a.ID,a.cCode,a.cDepCode,c.cDepName,a.cWhCode,d.cWhName,a.cMPoCode ,a.cMaker ,a.dnmaketime ,a.cHandler ,a.dnverifytime ,
  51. b.AutoID,b.iRSRowNO ,b.cInvCode ,b.iQuantity ,b.iNum ,b.iMPoIds from rdrecord10 a
  52. left join rdrecords10 b on a.ID=b.ID
  53. left join Department c on a.cDepCode=c.cDepCode
  54. left join Warehouse d on a.cWhCode=d.cWhCode WHERE 1=1";
  55. if (!string.IsNullOrWhiteSpace(info.MRCVCode))
  56. {
  57. sql += " and a.cCode='{0}'";
  58. }
  59. if (!string.IsNullOrWhiteSpace(info.MTime.ToString()))
  60. {
  61. sql += " and ISNULL(a.dnmodifytime,ISNULL(a.dnverifytime, ISNULL(a.dnmodifytime, a.dnmaketime)))>='{1}'";
  62. }
  63. if (!string.IsNullOrWhiteSpace(info.User))
  64. {
  65. sql += "and a.CMAKER='{2}'";
  66. }
  67. sql = string.Format(sql, info.MRCVCode, info.MTime, info.User);
  68. dt = DBHelper.SQlReturnData(sql, cmd);
  69. json = JsonConvert.SerializeObject(dt);
  70. if (dt.Rows.Count <= 0 || dt == null)
  71. throw new Exception("成品入库单:" + info.MRCVCode + ",无信息!");
  72. }
  73. cmd.Transaction.Commit();
  74. return json;
  75. }
  76. catch (Exception ex)
  77. {
  78. cmd.Transaction.Rollback();
  79. log.Error(ex.Message);
  80. throw new Exception(ex.Message);
  81. }
  82. finally
  83. {
  84. if (conn.State == ConnectionState.Open)
  85. {
  86. conn.Close();
  87. }
  88. conn.Dispose();
  89. }
  90. }
  91. /// <summary>
  92. /// 创建成品入库单
  93. /// </summary>
  94. /// <param name="Bills"></param>
  95. /// <returns></returns>
  96. public string CreateManufactureReceiveDoc(List<ICSManufactureReceiveDoc> Bills)
  97. {
  98. string msg = "";
  99. string sql = string.Empty;
  100. int num = 0;
  101. string iFatherIdTwo = string.Empty;
  102. VouchKey key = new VouchKey();
  103. SqlConnection conn = new System.Data.SqlClient.SqlConnection(connString);
  104. conn.Open();
  105. SqlTransaction sqlTran = conn.BeginTransaction();
  106. SqlCommand cmd = new SqlCommand();
  107. cmd.Transaction = sqlTran;
  108. cmd.Connection = conn;
  109. try
  110. {
  111. if (Bills.Count <= 0)
  112. {
  113. throw new Exception("传送数据为空!");
  114. }
  115. LogInfo(Bills);
  116. //MergeObject(Bills, cmd);
  117. //string ERPName = U8Helper.GetERPName();
  118. foreach (ICSManufactureReceiveDoc head in Bills)
  119. {
  120. num = head.details.Count();
  121. Dictionary<string, int> dic = DBHelper.GetAllCode("" + ERPDB + "", "ReceiveDoc", "" + num + "");
  122. int iFatherId = Convert.ToInt32(dic["iFatherId"].ToString());
  123. int iChildId = Convert.ToInt32(dic["iChildId"].ToString());
  124. DateTime date = DateTime.Now;
  125. string iBaseCodeLen = DBHelper.GetAllRDCode("0411", "" + date + "", "admin");
  126. string DEF_ID = DBHelper.GetDefaultTemplate("0411", cmd);
  127. string cRDcode = DBHelper.GetRDCode("生产完工入库", cmd);
  128. //Person personEntity = new Person();
  129. //personEntity = U8Helper.GetDepCodeByUserCode(head.UserCode, cmd);
  130. DateTime dvDate = DateTime.Now.Date;
  131. #region 产成品入库单表头
  132. sql = @"INSERT INTO dbo.rdrecord10
  133. ( ID ,bRdFlag ,cVouchType ,cBusType ,cSource ,cWhCode ,dDate ,
  134. cCode ,cRdCode ,cDepCode ,cHandler ,bTransFlag ,cMaker ,
  135. cDefine1 ,cDefine2 ,cDefine3 ,cDefine4 ,cDefine5 ,cDefine6 ,
  136. cDefine7 ,cDefine8 ,cDefine9 ,cDefine10 ,dVeriDate ,bpufirst ,
  137. biafirst ,VT_ID ,bIsSTQc ,cDefine11 ,cDefine12 ,cDefine13 ,
  138. cDefine14 ,cDefine15 ,cDefine16 ,cMPoCode ,iproorderid ,
  139. bFromPreYear ,bIsComplement ,iDiscountTaxType ,ireturncount ,
  140. iverifystate ,iswfcontrolled ,cModifyPerson ,dnmaketime ,
  141. dnverifytime ,bredvouch ,iPrintCount )
  142. SELECT @ID,1,'10','','',@cWhCode,convert(datetime,convert(varchar(10),getdate(),120)),
  143. @cCode,@RdCode,@DepCode,@cHandler,0,@cMaker,
  144. a.Define1,a.Define2,a.Define3,a.Define4,a.Define5,a.Define6,
  145. a.Define7,a.Define8,a.Define9,a.Define10,@dDate,0,
  146. 0,@VT_ID,0,a.Define11,a.Define12,a.Define13,
  147. a.Define14,a.Define15,a.Define16,a.MoCode,a.MoId,
  148. 0,0,0,0,
  149. 0,0,'',@dDate,
  150. @dDate,0,0
  151. FROM dbo.mom_order a
  152. WHERE a.MoCode='" + head.MOCode + "'";
  153. cmd.Parameters.Clear();
  154. cmd.Parameters.Add(new SqlParameter("@ID", iFatherId));
  155. cmd.Parameters.Add(new SqlParameter("@cWhCode", head.WHCode));
  156. cmd.Parameters.Add(new SqlParameter("@cCode", iBaseCodeLen));
  157. cmd.Parameters.Add(new SqlParameter("@cDepCode", head.DepCode));
  158. cmd.Parameters.Add(new SqlParameter("@cHandler", head.User));
  159. cmd.Parameters.Add(new SqlParameter("@cMaker", head.User));
  160. cmd.Parameters.Add(new SqlParameter("@VT_ID", DEF_ID));
  161. cmd.Parameters.Add(new SqlParameter("@DepCode", head.DepCode));
  162. cmd.Parameters.Add(new SqlParameter("@dDate", dvDate));
  163. cmd.Parameters.Add(new SqlParameter("@RdCode", cRDcode));
  164. cmd.CommandText = sql;
  165. try
  166. {
  167. int count = cmd.ExecuteNonQuery();
  168. if (count <= 0)
  169. {
  170. log.Error("生成成品入库单表头失败,受影响行数<=0;");
  171. throw new Exception("生成成品入库单表头失败,受影响行数<=0;");
  172. }
  173. }
  174. catch (Exception ex)
  175. {
  176. log.Error("生成成品入库单表头失败!SQL:\r\n" + sql, ex);
  177. throw new Exception("生成成品入库单表头失败!SQL:\r\n" + sql, ex);
  178. }
  179. #endregion
  180. #region 产成品入库单表体
  181. foreach (ICSManufactureReceiveDocs body in head.details)
  182. {
  183. #region 判断工单行是否关闭,关闭不能入库
  184. sql = @"SELECT ISNULL(a.CloseUser,'') as CloseUser,b.MoCode,a.SortSeq FROM dbo.mom_orderdetail a INNER JOIN
  185. dbo.mom_order b ON b.MoId = a.MoId WHERE a.MoDId = '" + body.MODetailID + "'";
  186. DataTable dtCheck = DBHelper.SQlReturnData(sql, cmd);
  187. if (dtCheck != null && dtCheck.Rows.Count > 0)
  188. {
  189. if (!string.IsNullOrEmpty(dtCheck.Rows[0]["CloseUser"].ToString()))
  190. {
  191. throw new Exception("工单号:" + dtCheck.Rows[0]["MoCode"].ToString() + ",行号:" + dtCheck.Rows[0]["SortSeq"].ToString() + ",已关闭,无法入库!");
  192. }
  193. }
  194. #endregion
  195. #region 生成产成品入库单表体
  196. //if (head.IsReturn == "1")
  197. //{
  198. // body.iQuantity = -body.iQuantity;
  199. //}
  200. sql = @"INSERT INTO dbo.rdrecords10
  201. ( AutoID ,ID ,cInvCode ,iQuantity ,cBatch ,iFlag ,
  202. cDefine22 ,cDefine23 ,cDefine24 ,cDefine25 ,cDefine26 ,cDefine27 ,
  203. cItemCode ,cName ,iNQuantity ,cDefine28 ,
  204. cDefine29 ,cDefine30 ,cDefine31 ,cDefine32 ,cDefine33 ,cDefine34 ,
  205. cDefine35 ,cDefine36 ,cDefine37 ,iMPoIds ,bRelated ,bLPUseFree ,
  206. iRSRowNO ,iOriTrackID ,bCosting ,cmocode ,imoseq ,iExpiratDateCalcu ,
  207. iorderdid ,iordertype,iordercode,iorderseq,isodid,isotype,csocode,isoseq,irowno ,iposflag )
  208. SELECT @AutoID,@ID,@cInvCode,@iQuantity,@cBatch,0,
  209. a.Define22,a.Define23,a.Define24,a.Define25,a.Define26,a.Define27,
  210. null,null,a.Qty,a.Define28,
  211. a.Define29,a.Define30,a.Define31,a.Define32,a.Define33,a.Define34,
  212. a.Define35,a.Define36,a.Define37,a.MoDId,0,0,
  213. 0,0,1,b.MoCode,a.SortSeq,0,
  214. a.OrderDid,a.OrderType,a.OrderCode,a.OrderSeq,a.SoDId,a.SoType,a.SoCode,a.SoSeq,@irowno,0
  215. FROM dbo.mom_orderdetail a
  216. INNER JOIN dbo.mom_order b ON a.MoId=b.MoId WHERE a.MoDId='" + body.MODetailID + "'";
  217. cmd.Parameters.Clear();
  218. cmd.Parameters.Add(new SqlParameter("@AutoID", iChildId));
  219. cmd.Parameters.Add(new SqlParameter("@ID", iFatherId));
  220. cmd.Parameters.Add(new SqlParameter("@cInvCode",body.InvCode));
  221. cmd.Parameters.Add(new SqlParameter("@iQuantity", body.Quantity));
  222. cmd.Parameters.Add(new SqlParameter("@cBatch", ""));
  223. cmd.Parameters.Add(new SqlParameter("@irowno", body.Sequence));
  224. cmd.CommandText = sql;
  225. try
  226. {
  227. int count = cmd.ExecuteNonQuery();
  228. if (count <= 0)
  229. {
  230. log.Error("生成材料出库单表头失败,受影响行数<=0;");
  231. throw new Exception("生成材料出库单表头失败,受影响行数<=0;");
  232. }
  233. }
  234. catch (Exception ex)
  235. {
  236. log.Error("生成材料出库单表头失败!SQL:\r\n" + sql, ex);
  237. throw new Exception("生成材料出库单表头失败!SQL:\r\n" + sql, ex);
  238. }
  239. #endregion
  240. #region 更新现存量
  241. key.cBustypeUN = "成品入库";
  242. key.cVouchTypeUN = "10";
  243. key.TableName = "IA_ST_UnAccountVouch10";
  244. DBHelper.UpdateCurrentStock(cmd, body.InvCode, head.WHCode, "", body.Quantity, key);
  245. #endregion
  246. #region 回写生产订单入库数量
  247. sql = @"UPDATE dbo.mom_orderdetail SET QualifiedInQty=ISNULL(QualifiedInQty,0)+" + body.Quantity + " where MoDId='" + body.MODetailID + "'";
  248. DBHelper.CmdExecuteNonQuery(sql, cmd, "回写生产订单入库数量失败!");
  249. #endregion
  250. #region 判断工单行是否全部入库
  251. sql = "SELECT (QualifiedInQty - Qty) as qty,QualifiedInQty FROM dbo.mom_orderdetail WHERE MoDId='" + body.MODetailID + "'";
  252. DataTable dtClose = DBHelper.SQlReturnData(sql, cmd);
  253. foreach (DataRow dr in dtClose.Rows)
  254. {
  255. if (Convert.ToDecimal(dr["qty"]) >= 0)
  256. {
  257. sql = "update mom_orderdetail set CloseTime = GETDATE(),CloseDate= CONVERT(NVARCHAR(15),GETDATE(),23), CloseUser ='" + head.User + "',Status=4 where MODId='" + body.MODetailID + "'";
  258. DBHelper.CmdExecuteNonQuery(sql, cmd, "生产订单行关闭失败!");
  259. }
  260. }
  261. #endregion
  262. iChildId--;
  263. }
  264. iFatherIdTwo += "'" + iFatherId + "',";
  265. #endregion
  266. }
  267. #region 查询
  268. sql = @" select a.ID as ID,a.ID as IDs,a.cCode as MRCVCode,a.cDepCode,c.cDepName,a.cWhCode,d.cWhName
  269. ,a.cMPoCode as MOCode ,a.cMaker as CreateUser ,a.dnmaketime as CreateDateTime
  270. ,a.cHandler as Checker ,a.dnverifytime as CheckDateTime
  271. from rdrecord10 a
  272. left join Department c on a.cDepCode=c.cDepCode
  273. left join Warehouse d on a.cWhCode=d.cWhCode WHERE A.cHandler IS NOT NULL AND A.ID in({0})
  274. select a.ID as IDs, b.AutoID as DetailID,b.irowno as Sequence ,b.cInvCode as InvCode ,
  275. b.iQuantity as Quantity ,b.iNum as Amount,b.iMPoIds as MODetailID
  276. from rdrecord10 a
  277. left join rdrecords10 b on a.ID=b.ID
  278. left join Department c on a.cDepCode=c.cDepCode
  279. left join Warehouse d on a.cWhCode=d.cWhCode WHERE A.cHandler IS NOT NULL AND A.ID in({0})";
  280. sql = string.Format(sql, iFatherIdTwo.TrimEnd(','));
  281. DataSet ds = DBHelper.SQlReturnDataSet(sql, cmd);
  282. string RelationName = "details";
  283. DataRelation drs = new DataRelation(RelationName, ds.Tables[0].Columns["IDs"], ds.Tables[1].Columns["IDs"]);
  284. ds.Relations.Add(drs);
  285. msg = DBHelper.DataSetToJson(ds, RelationName);
  286. #endregion
  287. cmd.Transaction.Commit();
  288. return msg;
  289. }
  290. catch (Exception ex)
  291. {
  292. cmd.Transaction.Rollback();
  293. log.Error(ex.Message);
  294. throw new Exception(ex.Message);
  295. }
  296. finally
  297. {
  298. if (conn.State == ConnectionState.Open)
  299. {
  300. conn.Close();
  301. }
  302. conn.Dispose();
  303. }
  304. }
  305. /// <summary>
  306. /// 审核成品入库单
  307. /// </summary>
  308. /// <param name="infos"></param>
  309. /// <returns></returns>
  310. public bool Approve(List<ICSManufactureReceiveDoc> infos)
  311. {
  312. bool ResultFlag = false;
  313. SqlConnection conn = new System.Data.SqlClient.SqlConnection(connString);
  314. conn.Open();
  315. SqlTransaction sqlTran = conn.BeginTransaction();
  316. SqlCommand cmd = new SqlCommand();
  317. cmd.Transaction = sqlTran;
  318. cmd.Connection = conn;
  319. try
  320. {
  321. if (infos.Count <= 0)
  322. {
  323. throw new Exception("传送数据为空!");
  324. }
  325. LogInfo(infos);
  326. foreach (ICSManufactureReceiveDoc head in infos)
  327. {
  328. string sql = "";
  329. ICSUserInfo userInfo = new ICSUserInfo();
  330. userInfo = DBHelper.GetPersonInfo(head.User, cmd);
  331. #region 检验单号是否存在
  332. sql = "select * from rdrecord10 where ID='" + head.ID + "'";
  333. DataTable dt = DBHelper.SQlReturnData(sql, cmd);
  334. if (dt != null && dt.Rows.Count > 0)
  335. {
  336. string cHandler = dt.Rows[0]["cHandler"].ToString();
  337. if (!string.IsNullOrEmpty(cHandler))
  338. {
  339. throw new Exception("单据ID:" + head.ID + "不是开立状态!");
  340. }
  341. }
  342. else
  343. {
  344. throw new Exception("单据ID:" + head.ID + "在U8中不存在!");
  345. }
  346. #endregion
  347. #region 审核其他出库单
  348. sql = @"UPDATE dbo.rdrecord10 SET cHandler='" + userInfo.UserName + @"' ,
  349. dVeriDate=CONVERT(VARCHAR(50),GETDATE(),112),dnverifytime=GETDATE() WHERE ID='" + head.ID + "'";
  350. DBHelper.CmdExecuteNonQuery(sql, cmd, "审核其他出库单失败!");
  351. #endregion
  352. sql = "select * from dbo.rdrecords10 a inner join rdrecord10 b on a.ID=b.ID where b.ID='" + head.ID + "';";
  353. DataTable dtChecks = DBHelper.SQlReturnData(sql, cmd);
  354. #region 更新现存量
  355. for (int i = 0; i < dtChecks.Rows.Count; i++)
  356. {
  357. //判断物料批号与现存量表批号是否一致、数量不能超过现存量物料数量
  358. sql = @"SELECT cBatch,iQuantity from CurrentStock WHERE cInvCode='" + dtChecks.Rows[i]["cInvCode"].ToString() + "'AND cBatch=''and cWhCode='" + dtChecks.Rows[i]["cWhCode"].ToString() + "'";
  359. DataTable dtItem = DBHelper.SQlReturnData(sql, cmd);
  360. if (dtItem != null && dtItem.Rows.Count > 0)
  361. {
  362. //if (!dtItem.Rows[0]["cBatch"].ToString().Equals(body.cBatch))
  363. //{
  364. // throw new Exception("物料条码的批号与U8现存量物料批号不一致,物料:" + body.cInvCode);
  365. //}
  366. if (Convert.ToDecimal(dtItem.Rows[0]["iQuantity"].ToString()) < Convert.ToDecimal(dtChecks.Rows[i]["iQuantity"].ToString()))
  367. {
  368. throw new Exception("物料条码的数量大于U8现存量物料数量,物料:" + dtChecks.Rows[i]["cInvCode"].ToString());
  369. }
  370. }
  371. else
  372. {
  373. throw new Exception("物料:" + dtChecks.Rows[i]["cInvCode"].ToString() + "在现存量表中不存在!");
  374. }
  375. VouchKey key = new VouchKey();
  376. key.cBustypeUN = "成品入库";
  377. key.cVouchTypeUN = "10";
  378. key.TableName = "IA_ST_UnAccountVouch10";
  379. DBHelper.UpdateCurrentStock(cmd, dtChecks.Rows[i]["cInvCode"].ToString(), dtChecks.Rows[i]["cWhCode"].ToString(), "", Convert.ToDecimal(dtChecks.Rows[i]["iQuantity"].ToString()), key);
  380. //回写fOutQuantityy
  381. // sql = @"Update CurrentStock set fOutQuantity=isnull(fOutQuantity,0)-" + Convert.ToDecimal(dtChecks.Rows[i]["iQuantity"].ToString()) + @"
  382. // where cInvCode='" + dtChecks.Rows[i]["cInvCode"].ToString() + "' and cWhCode='" + dtChecks.Rows[i]["cWhCode"].ToString() + "' ";
  383. //if (body.cBatch != null)
  384. //{
  385. // sql += "and cBatch='" + body.cBatch + "'";
  386. //}
  387. //else
  388. //{
  389. // sql += "and cBatch=''";
  390. //}
  391. //DBHelper.CmdExecuteNonQuery(sql, cmd, "回写fOutQuantity失败!");
  392. //if (head.UpdateTodoQuantity == true)
  393. //{
  394. }
  395. #endregion
  396. }
  397. cmd.Transaction.Commit();
  398. ResultFlag = true;
  399. return ResultFlag;
  400. }
  401. catch (Exception ex)
  402. {
  403. cmd.Transaction.Rollback();
  404. log.Error(ex.Message);
  405. throw new Exception(ex.Message);
  406. }
  407. finally
  408. {
  409. if (conn.State == ConnectionState.Open)
  410. {
  411. conn.Close();
  412. }
  413. conn.Dispose();
  414. }
  415. }
  416. /// <summary>
  417. /// 删除成品入库单
  418. /// </summary>
  419. /// <param name="infos"></param>
  420. /// <returns></returns>
  421. public string Delete(List<ICSManufactureReceiveDoc> infos)
  422. {
  423. List<ICSManufactureReceiveDoc> szJson = new List<ICSManufactureReceiveDoc>();
  424. if (infos.Count <= 0)
  425. {
  426. throw new Exception("传送数据为空!");
  427. }
  428. string res = string.Empty;
  429. SqlConnection conn = new System.Data.SqlClient.SqlConnection(connString);
  430. conn.Open();
  431. SqlTransaction sqlTran = conn.BeginTransaction();
  432. SqlCommand cmd = new SqlCommand();
  433. cmd.Transaction = sqlTran;
  434. cmd.Connection = conn;
  435. try
  436. {
  437. string sql = string.Empty;
  438. foreach (ICSManufactureReceiveDoc info in infos)
  439. {
  440. if (info.MTime < new DateTime(2000, 01, 01))
  441. throw new Exception("请输入正确的操作时间:" + info.MTime);
  442. sql = @" DELETE rdrecord10 WHERE ID={0}";
  443. sql = string.Format(sql, info.ID);
  444. DBHelper.CmdExecuteNonQuery(sql, cmd, "未查询到对应数据!");
  445. }
  446. cmd.Transaction.Commit();
  447. return res;
  448. ;
  449. }
  450. catch (Exception ex)
  451. {
  452. cmd.Transaction.Rollback();
  453. log.Error(ex.Message);
  454. throw new Exception(ex.Message);
  455. }
  456. finally
  457. {
  458. if (conn.State == ConnectionState.Open)
  459. {
  460. conn.Close();
  461. }
  462. conn.Dispose();
  463. }
  464. }
  465. /// <summary>
  466. ///
  467. /// 记录日志
  468. /// </summary>
  469. /// <param name="Bills"></param>
  470. private void LogInfo(List<ICSManufactureReceiveDoc> Bills)
  471. {
  472. string HeadList = string.Empty;
  473. string BodyList = string.Empty;
  474. foreach (ICSManufactureReceiveDoc head in Bills)
  475. {
  476. HeadList += "\r\n 表头主键ID:" + head.ID + ",仓库:" + head.WHCode + ",用户:" + head.User;
  477. foreach (ICSManufactureReceiveDocs body in head.details)
  478. {
  479. BodyList += "\r\n 表体主键ID: " + body.MODetailID + ",数量:" + body.Quantity;
  480. }
  481. }
  482. log.Info(HeadList);
  483. log.Info(BodyList);
  484. }
  485. }
  486. }