protected void Save_Click(object sender, EventArgs e)
        {
            //领料单明细详情
            var str = _key.Split(',');

            if (!string.IsNullOrEmpty(_key))
            {
                //领料单明细详情
                MMS_PurchasePlanDetail purPlanDetail = PurchasePlanService.Instance.GetInfoDetail(Convert.ToInt32(str[0]));
                purPlanDetail.OperatorDate = DateTime.Now;
                try
                {
                    if (purPlanDetail.CheckQuantity == 0 && string.IsNullOrEmpty(purPlanDetail.AuditFlag))
                    {
                        purPlanDetail.Quantity = Convert.ToInt32(quantity.Value);
                        //purPlanDetail.
                        if (Convert.ToInt32(quantity.Value) != Convert.ToInt32(str[1]))
                        {
                            PurchasePlanService.Instance.UpdateInfoDetail(purPlanDetail);
                            ShowMsgHelper.AlertMsg("操作成功!");
                        }
                    }
                    else
                    {
                        ShowMsgHelper.Alert_Error("未发货状态才能修改数量!");
                    }
                }
                catch (Exception ex)
                {
                    ShowMsgHelper.Alert_Error("请输入正确的数字!");
                }
            }
        }
        public bool UpdateInfoDetail(MMS_PurchasePlanDetail info)
        {
            var query = from item in dc.MMS_PurchasePlanDetail
                        where item.ID == info.ID
                        select item;

            BatchEvaluate.Eval(info, query.First());
            dc.SubmitChanges();
            return(true);
        }
Exemple #3
0
        private void DetailTextBoxToModel(TPurchasePlanDetail tinfo)
        {
            MMS_PurchasePlanDetail detail = tinfo.DetDetail;

            detail.PurchaseBillCode = txtPurchasePlanBillCode.Text; //入库单号
            detail.ProductCode      = txtProductCode.Text;          //货品代码
            detail.Memo             = txtComm.Text;                 //手写备注
            if (!string.IsNullOrEmpty(txtQuantity.Text))            //数量
            {
                detail.Quantity = Convert.ToInt32(txtQuantity.Text);
            }
            detail.Price = Convert.ToDouble(txtPrice.Text.ToString().Trim());

            detail.AuditAccount = FindListAuditUser(txtProductCode.Text.ToString()).ToString();
        }
Exemple #4
0
        private void ModelToDetailTextBox(TPurchasePlanDetail tinfo)
        {
            //调用业务层方法取货品信息实体
            MMS_MaterialInfo Material = MaterialInfoService.Instance.GetProductInfoByCode(tinfo.DetDetail.ProductCode);
            // MMS_ProductInfo product = ProductInfoService.Instance.GetProductInfoByCode(tinfo.DetDetail.ProductCode);
            MMS_PurchasePlanDetail detail = tinfo.DetDetail;

            txtProductCode.Text = detail.ProductCode;              //货品代码
            txtShortName.Text   = Material.Material_Name;          //货品简称
            txtSpecs.Text       = Material.Material_Specification; //规格
            ddlUnit.Text        = Material.Material_Unit;          //计量单位
            txtVendor.Text      = Material.Material_Supplier;      //供应商
            txtQuantity.Text    = detail.Quantity.ToString();      //数量
            txtComm.Text        = detail.Memo.ToString();

            // txtPrice.Text = hidPrice.Value.ToString();
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType     = "text/plain";
            context.Response.Buffer          = true;
            context.Response.ExpiresAbsolute = DateTime.Now.AddDays(-1.0);
            context.Response.AddHeader("pragma", "no-cache");
            context.Response.AddHeader("cache-control", "");
            context.Response.CacheControl = "no-cache";

            var text = context.Request["data"];

            try
            {
                if (text != null)
                {
                    string[] str_data = text.Split(',');
                    foreach (string str in str_data)
                    {
                        string str_replace = str.Replace('\"', ' ');
                        str_replace = str_replace.Replace('[', ' ');
                        str_replace = str_replace.Replace(']', ' ');
                        str_replace = str_replace.Trim();
                        MMS_PurchasePlanDetail purPlanDetail = PurchasePlanService.Instance.GetInfoDetail(Convert.ToInt32(str_replace));
                        purPlanDetail.AuditFlag    = "0"; //退货处理
                        purPlanDetail.OperatorDate = DateTime.Now;
                        //purPlanDetail.
                        PurchasePlanService.Instance.UpdateInfoDetail(purPlanDetail);
                    }
                }


                else
                {
                    context.Session.Abandon();
                    context.Session.Clear();
                    context.Response.Write(1);
                    context.Response.End();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType     = "text/plain";
            context.Response.Buffer          = true;
            context.Response.ExpiresAbsolute = DateTime.Now.AddDays(-1.0);
            context.Response.AddHeader("pragma", "no-cache");
            context.Response.AddHeader("cache-control", "");
            context.Response.CacheControl = "no-cache";

            string Action = context.Request["action"];
            int    OutNum = 0;
            string Num    = context.Request["num"];
            var    text   = context.Request["key"];

            try
            {
                if (text != null)
                {
                    string[] str_data = text.Split(',');
                    foreach (string str in str_data)
                    {
                        string str_replace = str.Replace('\"', ' ');
                        str_replace = str_replace.Replace('[', ' ');
                        str_replace = str_replace.Replace(']', ' ');
                        str_replace = str_replace.Trim();
                        MMS_PurchasePlanDetail    purPlanDetail = PurchasePlanService.Instance.GetInfoDetail(Convert.ToInt32(str_replace));
                        List <MMS_PurchaseDetail> Listpurdetail = PurchaseService.Instance.GetDetailPriceList(purPlanDetail.ProductCode, purPlanDetail.Price);
                        Listpurdetail.Select(item => item.Quantity - item.UseQuantity > 0);
                        Listpurdetail.OrderBy(item => item.PurchaseBillCode);

                        if (Num.Trim() == "")
                        {
                            OutNum = purPlanDetail.Quantity;
                        }
                        else
                        {
                            OutNum = Convert.ToInt32(Num);
                        }

                        foreach (MMS_PurchaseDetail purdetail in Listpurdetail)
                        {
                            Int32 i = 0;
                            if (purdetail.Quantity - purdetail.UseQuantity >= OutNum - purPlanDetail.CheckQuantity && OutNum - purPlanDetail.CheckQuantity > 0)
                            {
                                i = OutNum - Convert.ToInt32(purPlanDetail.CheckQuantity);
                                purdetail.UseQuantity = purdetail.UseQuantity + (OutNum - Convert.ToInt32(purPlanDetail.CheckQuantity));
                                PurchaseService.Instance.UpdateInfoDetail(purdetail);
                                purPlanDetail.CheckQuantity = OutNum;
                                PurchasePlanService.Instance.UpdateInfoDetail(purPlanDetail);


                                MMS_Delivery_Detail deliverDetail = new MMS_Delivery_Detail();
                                deliverDetail.PurchaseBillCode = purPlanDetail.PurchaseBillCode;
                                deliverDetail.ProductCode      = purPlanDetail.ProductCode;
                                deliverDetail.Lot      = purdetail.Lot;
                                deliverDetail.Quantity = i;
                                deliverDetail.Price    = purdetail.Price;
                                //  deliverDetail.Operator = RequestSession.GetSessionUser().UserAccount.ToString();
                                deliverDetail.OperatorDate = DateTime.Now;
                                DeliveryInfoService.Instance.InsertInfo(deliverDetail);

                                break;
                            }
                            else
                            {
                                if (purdetail.Quantity - purdetail.UseQuantity > 0)
                                {
                                    if ((OutNum - purPlanDetail.CheckQuantity) > (purdetail.Quantity - purdetail.UseQuantity))
                                    {
                                        i = Convert.ToInt32(purdetail.Quantity) - Convert.ToInt32(purdetail.UseQuantity);
                                        purPlanDetail.CheckQuantity = Convert.ToInt32(purPlanDetail.CheckQuantity) + (Convert.ToInt32(purdetail.Quantity) - Convert.ToInt32(purdetail.UseQuantity));
                                        PurchasePlanService.Instance.UpdateInfoDetail(purPlanDetail);
                                        purdetail.UseQuantity = purdetail.Quantity;
                                        PurchaseService.Instance.UpdateInfoDetail(purdetail);
                                    }



                                    MMS_Delivery_Detail deliverDetail = new MMS_Delivery_Detail();
                                    deliverDetail.PurchaseBillCode = purPlanDetail.PurchaseBillCode;
                                    deliverDetail.ProductCode      = purPlanDetail.ProductCode;
                                    deliverDetail.Lot      = purdetail.Lot;
                                    deliverDetail.Quantity = i;
                                    deliverDetail.Price    = purdetail.Price;
                                    // deliverDetail.Operator = HttpContext.Current.Session["UserName"].ToString();
                                    deliverDetail.OperatorDate = DateTime.Now;
                                    DeliveryInfoService.Instance.InsertInfo(deliverDetail);
                                }
                            }
                        }
                    }
                }
                else
                {
                    context.Session.Abandon();
                    context.Session.Clear();
                    context.Response.Write(1);
                    context.Response.End();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
 public bool UpdateInfoDetail(MMS_PurchasePlanDetail info)
 {
     return(dao.UpdateInfoDetail(info));
 }