Beispiel #1
0
 public void SaveProductBOM(Sender sender, ProductBOM obj)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy(true))
         {
             ProductBOM model = new ProductBOM();
             model.ID = obj.ID;
             if (op.LoadProductBOM(model) == 0)
             {
                 string key   = "BOM" + DateTime.Now.ToString("yy");
                 int    index = this.GetIncrease(sender, key);
                 obj.BOMID     = key + DateTime.Now.Month.ToString("00") + index.ToString("00000");
                 obj.Created   = DateTime.Now;
                 obj.CreatedBy = sender.UserCode + "." + sender.UserName;
                 op.InsertProductBOM(obj);
             }
             else
             {
                 obj.Created   = DateTime.Now;
                 obj.CreatedBy = sender.UserCode + "." + sender.UserName;
                 op.UpdateProductBOMByID(obj);
             }
             op.CommitTransaction();
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Beispiel #2
0
 public int UpdateProductBOMStatusByBOMID(Sender sender, ProductBOM obj)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy())
         {
             return(op.UpdateProductBOMStatusByBOMID(obj));
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Beispiel #3
0
 public List <ProductBOM> GetProductBOMByID(Sender sender, Int32 ID)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy())
         {
             ProductBOM obj = new ProductBOM();
             obj.ID = ID;
             return(op.LoadProductBOMByID(obj));
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Beispiel #4
0
 public ProductBOM GetProductBOM(Sender sender, Int32 ID)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy())
         {
             ProductBOM obj = new ProductBOM();
             obj.ID = ID;
             if (op.LoadProductBOM(obj) == 0)
             {
                 return(null);
             }
             return(obj);
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Beispiel #5
0
        public void OrderReview()
        {
            try
            {
                using (ProxyBE p = new ProxyBE())
                {
                    string OrderID = Request["OrderID"];
                    if (string.IsNullOrEmpty(OrderID))
                    {
                        throw new Exception("OrderID:参数无效");
                    }
                    string Remark = Request["Remark"];
                    if (string.IsNullOrEmpty(Remark))
                    {
                        throw new Exception("Remark:参数无效");
                    }
                    Order order = p.Client.GetOrder(SenderUser, Guid.Parse(OrderID));

                    if (order.Status.ToUpper() == OrderStatus.F.ToString())
                    {
                        SaveOrderArgs args = new SaveOrderArgs();

                        OrderStep    step = p.Client.GetOrderStepByStepCode(SenderUser, StepCode.ordersreview.ToString());
                        OrderStepLog ot   = new OrderStepLog();
                        ot.StepID         = Guid.NewGuid();
                        ot.OrderID        = order.OrderID;
                        ot.StepNo         = step.StepNo;
                        ot.StepName       = step.StepName;
                        ot.Remark         = Remark;
                        args.OrderStepLog = ot;

                        order.Status = OrderStatus.G.ToString();
                        order.StepNo = step.StepNo;
                        args.Order   = order;

                        p.Client.SaveOrder(SenderUser, args);
                        p.Client.UpdatePartnerOrder(args.Order);
                    }

                    #region PartnerTransDetail
                    string Payee     = Request["Payee"].ToString();     //收款人
                    string Amount    = Request["Amount"].ToString();    //收款金额
                    string TransDate = Request["TransDate"].ToString(); //收款日期
                    string VoucherNo = Request["VoucherNo"].ToString(); //凭证号
                    if (!string.IsNullOrEmpty(Payee) && !string.IsNullOrEmpty(Amount) && !string.IsNullOrEmpty(TransDate) && !string.IsNullOrEmpty(VoucherNo))
                    {
                        ReviewDetail model = new ReviewDetail()
                        {
                            TransID   = Guid.NewGuid(),
                            OrderID   = order.OrderID,
                            Payee     = Payee,
                            Amount    = decimal.Parse(Amount),
                            TransDate = Convert.ToDateTime(TransDate),
                            VoucherNo = VoucherNo,
                        };
                        p.Client.SaveReviewDetail(SenderUser, model);
                    }
                    #endregion

                    #region ProductBOM
                    List <OrderProduct> list = p.Client.GetOrderProductByOrderID(SenderUser, order.OrderID);
                    foreach (OrderProduct Item in list)
                    {
                        ProductBOM model = new ProductBOM()
                        {
                            ProductCode = Item.ProductCode,
                            Status      = false,
                        };
                        p.Client.SaveProductBOM(SenderUser, model);
                    }
                    #endregion
                }
                WriteSuccess();
            }
            catch (Exception ex)
            {
                WriteError(ex.Message, ex);
            }
        }