コード例 #1
0
ファイル: BillHandler.cs プロジェクト: 0000duck/MES-3
 /// <summary>
 ///     添加【采购订单】
 /// </summary>
 /// <param name="db"></param>
 /// <param name="bill">采购订单单</param>
 /// <param name="details">订单明细</param>
 /// <returns></returns>
 public static void AddPO(SpareEntities db, List <TB_BILL> billlist, List <TB_PO> details)
 {
     foreach (var bill in billlist)
     {
         if (bill.BillNum == null)
         {
             SetBillNum(bill);
             details.ForEach(p => p.BillNum = bill.BillNum);
         }
     }
     PoController.AddPoList(db, billlist, details);
 }
コード例 #2
0
ファイル: FormPo.cs プロジェクト: 0000duck/MES-3
        private void GetDataList(DataTable dt)
        {
            var billList   = new List <TB_BILL>();
            var detailList = new List <TB_PO>();

            foreach (DataRow dr in dt.Rows)

            {
                string billNum = dr[0].ToString();
                if (billList.All(p => p.BillNum != billNum))
                {
                    billList.Add(new TB_BILL
                    {
                        BillNum  = billNum,
                        BillType = (int)_billType,
                        SplyId   = dr[6].ToString(),
                        BillTime = Convert.ToDateTime(dr[7]),
                        OperName = GlobalVar.Oper.OperName,
                        State    = (int)BillState.New,
                    });
                }
                detailList.Add(new TB_PO
                {
                    BillNum   = billNum,
                    Line      = Convert.ToInt32(dr[1]),
                    PartCode  = dr[2].ToString(),
                    BillQty   = Convert.ToDecimal(dr[3]),
                    ArrialQty = Convert.ToDecimal(dr[3]),
                    State     = 0,
                    Remark    = dr[10].ToString(),
                });
            }

            try
            {
                PoController.AddPoList(_db, billList, detailList);
                EntitiesFactory.SaveDb(_db);
                MessageHelper.ShowInfo("数据导入成功");
            }
            catch (Exception ex)
            {
                MessageHelper.ShowInfo(ex.ToString());
            }
        }