예제 #1
0
 protected void btnUpdate_Click(object sender, EventArgs e)
 {
     if (this.FormCheck())
     {
         try
         {
             TB_PO poModel = new TB_PO();
             poModel.DataTime = Convert.ToDateTime(txtDataTime.Text);
             poModel.InvName  = txtInvName.Text;
             poModel.Num      = Convert.ToDecimal(txtNum.Text);
             poModel.Price    = Convert.ToDecimal(txtPrice.Text);
             poModel.Unit     = txtUnit.Text;
             poModel.UnitName = txtUnitName.Text;
             //poModel.CreateTime = DateTime.Now;
             //poModel.CreateUser = Convert.ToInt32(Session["currentUserId"]);
             poModel.Id = Convert.ToInt32(base.Request["Id"]);
             if (this.poSer.Update(poModel))
             {
                 base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('修改成功!');</script>");
             }
             else
             {
                 base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('修改失败!');</script>");
             }
         }
         catch (Exception ex)
         {
             base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('" + ex.Message + "!');</script>");
         }
     }
 }
예제 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!base.IsPostBack)
     {
         if (base.Request["Id"] != null)
         {
             this.btnAdd.Visible = false;
             TB_PO poModel = this.poSer.GetModel(Convert.ToInt32(base.Request["Id"]));
             txtDataTime.Text = poModel.DataTime.ToShortDateString();
             txtInvName.Text  = poModel.InvName;
             txtNum.Text      = poModel.Num.ToString();
             txtPrice.Text    = poModel.Price.ToString();
             txtTotal.Text    = (Convert.ToDecimal(txtNum.Text) * Convert.ToDecimal(txtPrice.Text)).ToString();
             txtUnit.Text     = poModel.Unit;
             txtUnitName.Text = poModel.UnitName;
             txtSeller.Text   = poModel.Seller;
         }
         else
         {
             this.btnUpdate.Visible = false;
         }
     }
 }
예제 #3
0
        private static void GetOAData(InterfaceEntities OAdb, SpareEntities db)
        {
            var SparePartlist = new List <TA_PART>();
            var SpareBillList = new List <TB_BILL>();
            var SparePOList   = new List <TB_PO>();
            //同步零件号
            var partlist = OAdb.OA_PART.Where(p => p.IsSyn == 0).ToList();

            if (partlist.Count > 0)
            {
                foreach (var part in partlist)
                {
                    var SparePart = PartController.GetPartByPartCode(db, part.code);
                    if (SparePart == null)
                    {
                        SparePart = new TA_PART();
                    }
                    SparePart.PartCode    = part.code;
                    SparePart.ErpPartCode = part.code;
                    SparePart.PartDesc1   = part.engname;
                    SparePart.PartDesc2   = part.name;
                    SparePart.Unit        = part.unit;
                    SparePart.BM          = "B";
                    SparePartlist.Add(SparePart);
                }
                PartController.AddOrUpdate(db, SparePartlist);
                NotifyController.AddNotify(db, GlobalVar.OperName, NotifyType.OAInterfaceBase, "", "");
            }

            //同步采购订单
            var OAPOBill = OAdb.OA_PO_MAIN.FirstOrDefault(p => p.IsSyn == 0);

            if (OAPOBill != null)
            {
                var _bill = new TB_BILL()
                {
                    BillNum  = OAPOBill.orderno,
                    BillType = (int)BillType.PuchaseOrder,
                    BillTime = DateTime.Now,
                    OperName = OAPOBill.@operator,
                    SplyId   = OAPOBill.suppliername,
                    Remark   = OAPOBill.remark
                };
                SpareBillList.Add(_bill);
                OAPOBill.IsSyn = 1;
                OAdb.OA_PO_MAIN.AddOrUpdate(OAPOBill);
                var OAPOList = OAdb.OA_PO_SUB.Where(p => p.OAMainID == OAPOBill.OAID);
                foreach (var oaPoSub in OAPOList)
                {
                    var SparePo = new TB_PO()
                    {
                        BillNum  = _bill.BillNum,
                        Line     = Convert.ToInt32(oaPoSub.prln),
                        PartCode = oaPoSub.itemnumber,
                        BillQty  = (decimal)oaPoSub.qty
                    };
                    SparePOList.Add(SparePo);
                }

                BillHandler.AddPO(db, SpareBillList, SparePOList);
                NotifyController.AddNotify(db, GlobalVar.OperName, NotifyType.OAInterfacePO, "", "");
            }
        }