示例#1
0
        protected void btSave_Click(object sender, EventArgs e)
        {
            SupplyInfo    info = new SupplyInfo();
            SupplyInfoBLL bll  = null;

            try
            {
                UIBindHelper.BindModelByControls(this.Page, info);

                bll = BLLFactory.CreateBLL <SupplyInfoBLL>();

                info.Details = JsonConvertHelper.DeserializeObject <List <SupplyMaterialInfo> >(this.hiMaterialList.Value);

                info.BATCHNUMBER = this.PLANID.SelectedItem.Text;
                if (this.hiID.Value == "")
                {
                    bll.Insert(info);
                }
                else
                {
                    info.CREATEUSER = this.HiCREATEUSER.Value;
                    info.CREATETIME = DateTime.Parse(this.HiCREATETIME.Value);
                    info.PID        = this.hiID.Value;
                    info.PLANID     = this.hiPlanID.Value;
                    info.PLName     = this.PLNAME.Text;
                    bll.Update(info);
                }
                ClientScript.RegisterStartupScript(this.GetType(), "myjs", "parent.refreshData();parent.closeAppWindow1();", true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#2
0
        protected void btDelete_Click(object sender, EventArgs e)
        {
            ArrayList     pkArray = null;
            SupplyInfoBLL bll     = null;

            try
            {
                bll = BLLFactory.CreateBLL <SupplyInfoBLL>();

                pkArray = GvHelper.GetPKValueByChk(this.GvList, 0, "cbxSelect", 0);

                foreach (object key in pkArray)
                {
                    bll.Delete(new SupplyInfo {
                        PID = key.ToString()
                    });
                }

                this.BindData();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#3
0
        private void BindData()
        {
            SupplyInfoBLL bll       = null;
            DataPage      dp        = new DataPage();
            SupplyInfo    condition = new SupplyInfo();

            try
            {
                bll = BLLFactory.CreateBLL <SupplyInfoBLL>();
                condition.BATCHNUMBER = this.BatchNumber.Text;


                PagerHelper.InitPageControl(this.AspNetPager1, dp, true);
                dp = bll.GetList(condition, dp);

                List <SupplyInfo> list = dp.Result as List <SupplyInfo>;
                this.GvList.DataSource = list;
                this.GvList.DataBind();

                for (int i = 0; i < this.GvList.Rows.Count; i++)
                {
                    string click = string.Format("return edit('{0}');", this.GvList.DataKeys[i]["PID"].ToString());

                    (this.GvList.Rows[i].Cells[7].Controls[0] as WebControl).Attributes.Add("onclick", click);
                }
                PagerHelper.SetPageControl(AspNetPager1, dp, true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#4
0
        private void BindData()
        {
            string        id   = Request.QueryString["id"];
            SupplyInfoBLL bll  = null;
            SupplyInfo    info = new SupplyInfo();

            try
            {
                bll = BLLFactory.CreateBLL <SupplyInfoBLL>();
                if (!string.IsNullOrEmpty(id))
                {
                    info.PID     = id;
                    info         = bll.Get(info);
                    info.Details = bll.GetList(info.PID);
                    UIBindHelper.BindForm(this.Page, info);
                    this.FNAME.Text          = info.FactoryName;
                    this.PDNAME.Text         = info.ProduceName;
                    this.PLNAME.Text         = info.PLName;
                    this.DELIVERYDATE.Text   = info.DELIVERYDATE.ToString("yyyy-MM-dd");
                    this.REMARK.Text         = info.REMARK;
                    this.hiID.Value          = info.PID;
                    this.HiCREATEUSER.Value  = info.CREATEUSER;
                    this.HiCREATETIME.Value  = info.CREATETIME.ToString();
                    this.hiPlanID.Value      = info.PLANID;
                    this.PLNAME.Text         = info.PLName;
                    this.BatchNumber.Visible = true;
                    this.PLANID.Visible      = false;
                }
                else
                {
                    info                     = new SupplyInfo();
                    info.Details             = new List <SupplyMaterialInfo>();
                    this.BatchNumber.Visible = false;
                    this.PLANID.Visible      = true;
                }

                //绑定明细
                DataGridResult <SupplyMaterialInfo> supplyMaterialInfo = new DataGridResult <SupplyMaterialInfo>();
                supplyMaterialInfo.Total = info.Details.Count;
                supplyMaterialInfo.Rows  = info.Details;

                foreach (SupplyMaterialInfo detail in info.Details)
                {
                    detail.DeleteAction = "deleteItem(\'" + detail.MATRIALID + "\')";
                }

                this.hiMaterialList.Value = supplyMaterialInfo.GetJsonSource();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#5
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentEncoding = Encoding.UTF8;
            context.Response.ContentType     = "application/json";
            ProducePlanBLL ppbll    = BLLFactory.CreateBLL <ProducePlanBLL>();
            SupplyInfoBLL  sibll    = BLLFactory.CreateBLL <SupplyInfoBLL>();
            string         planID   = context.Request.QueryString["planID"];
            SupplyInfo     siresult = ppbll.GetProducePlanInfoByID(planID);

            if (siresult == null)
            {
                siresult = new SupplyInfo();
                if (siresult != null)
                {
                    siresult.PID = "none";
                }
            }
            else
            {
                //获取生产计划
                ProducePlan plan = new ProducePlanBLL().Get(new ProducePlan {
                    PID = planID
                });

                //获取bom明细
                siresult.Details = sibll.GetMaterialListByBOM(siresult.ProductionID);

                //获取bom基本信息
                ProduceBOM bomBase = new ProduceDOMBLL().GetByProduceID(siresult.ProductionID);

                //生成要货明细
                foreach (SupplyMaterialInfo detail in siresult.Details)
                {
                    if (bomBase.Amount != 0)
                    {
                        detail.AMOUNT = Convert.ToInt32(decimal.Parse(plan.PLANAMOUNT)) / bomBase.Amount;
                    }
                    else
                    {
                        detail.AMOUNT = 0;
                    }
                }
            }

            context.Response.Write(LAF.Common.Serialization.JsonConvertHelper.GetSerializes(siresult));
        }
示例#6
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentEncoding = Encoding.UTF8;
            context.Response.ContentType     = "application/json";
            string type        = context.Request.QueryString["Type"];
            string code        = context.Request.QueryString["Code"];
            string batchNumber = "";

            switch (type)
            {
            case "CP":
                ProducePlanBLL bll    = BLLFactory.CreateBLL <ProducePlanBLL>();
                ProductInfo    result = bll.GetPNameByIDBatchNumber(code);
                if (result == null)
                {
                    result = new ProductInfo();
                    if (result != null)
                    {
                        result.PID = "none";
                    }
                }
                context.Response.Write(LAF.Common.Serialization.JsonConvertHelper.GetSerializes(result));
                break;

            case "CP2":
                ProducePlanBLL bllGoodInfo    = BLLFactory.CreateBLL <ProducePlanBLL>();
                GoodInfo       resultGoodInfo = bllGoodInfo.GetGoodInfoByBatchNumber(code);
                if (resultGoodInfo == null)
                {
                    resultGoodInfo = new GoodInfo();
                    if (resultGoodInfo != null)
                    {
                        resultGoodInfo.PID = "none";
                    }
                }
                context.Response.Write(LAF.Common.Serialization.JsonConvertHelper.GetSerializes(resultGoodInfo));
                break;

            case "CB":
                EquipmentBLL  bll2    = BLLFactory.CreateBLL <EquipmentBLL>();
                EquipmentInfo result2 = bll2.GetInfoByBarCode(code);
                if (result2 == null)
                {
                    result2 = new EquipmentInfo();
                    if (result2 != null)
                    {
                        result2.PID = "none";
                    }
                }
                context.Response.Write(LAF.Common.Serialization.JsonConvertHelper.GetSerializes(result2));
                break;

            case "GX":    //根据工位条码获取加工工序
                ProcessInfoBLL bll3 = BLLFactory.CreateBLL <ProcessInfoBLL>();
                Manage.Entity.MES.ProcessInfo result3 = bll3.GetInfoByWS(code);
                if (result3 == null)
                {
                    result3 = new Manage.Entity.MES.ProcessInfo();
                    if (result3 != null)
                    {
                        result3.PID = "none";
                    }
                }
                context.Response.Write(LAF.Common.Serialization.JsonConvertHelper.GetSerializes(result3));
                break;

            case "GX2":
                ProcessInfoBLL bll4 = BLLFactory.CreateBLL <ProcessInfoBLL>();
                batchNumber = context.Request.QueryString["BatchNumber"];
                Manage.Entity.MES.ProcessInfo result4 = bll4.GetInfoByBarCodeAndBatchNumber(code, batchNumber);
                if (result4 == null)
                {
                    result4 = new Manage.Entity.MES.ProcessInfo();
                    if (result4 != null)
                    {
                        result4.PID = "none";
                    }
                }
                context.Response.Write(LAF.Common.Serialization.JsonConvertHelper.GetSerializes(result4));
                break;

            case "PP":
                ProducePlanBLL ppbll    = BLLFactory.CreateBLL <ProducePlanBLL>();
                SupplyInfoBLL  sibll    = BLLFactory.CreateBLL <SupplyInfoBLL>();
                string         id       = context.Request.QueryString["id"];
                SupplyInfo     siresult = ppbll.GetProducePlanInfoByID(id);
                if (siresult == null)
                {
                    siresult = new SupplyInfo();
                    if (siresult != null)
                    {
                        siresult.PID = "none";
                    }
                }
                else
                {
                    siresult.Details = sibll.GetMaterialListByBOM(siresult.ProductionID);
                }

                context.Response.Write(LAF.Common.Serialization.JsonConvertHelper.GetSerializes(siresult));
                break;

            case "ZJ":
                QualityCheckBLL qcBll = BLLFactory.CreateBLL <QualityCheckBLL>();
                batchNumber = context.Request.QueryString["BatchNumber"];
                QualityCheckInfo qualityCheckInfo = qcBll.GetPDInfo(batchNumber);
                if (qualityCheckInfo == null)
                {
                    qualityCheckInfo    = new QualityCheckInfo();
                    qualityCheckInfo.ID = "none";
                }
                context.Response.Write(LAF.Common.Serialization.JsonConvertHelper.GetSerializes(qualityCheckInfo));
                break;

            default:
                break;
            }
        }
示例#7
0
文件: UseMatBLL.cs 项目: 48401298/efp
        public UseMatBill Build(string supplyID)
        {
            UseMatBill bill = new UseMatBill();

            SupplyInfo supply = new SupplyInfo()
            {
                PID = supplyID
            };

            //获取要货信息
            supply         = new SupplyInfoBLL().Get(supply);
            supply.Details = new SupplyInfoBLL().GetList(supply.PID);

            bill.PID      = Guid.NewGuid().ToString();
            bill.SUPPLYID = supply.PID;
            bill.Amounts  = new List <UseMatAmount>();
            bill.Details  = new List <UseMatDetail>();

            UseMatDAL umDAL = new UseMatDAL();

            foreach (SupplyMaterialInfo detail in supply.Details)
            {
                bill.Amounts.Add(new UseMatAmount {
                    PID = Guid.NewGuid().ToString(), USEID = bill.PID, MATRIALID = detail.MATRIALID, AMOUNT = detail.AMOUNT, Unit = detail.Unit
                });
                //获取可用库存
                List <WHMatAmount> stockList = new UseMatDAL().GetMayUseStock(new WHMatAmount {
                    Warehouse = supply.Warehouse, MatID = detail.MATRIALID
                });

                if (stockList.Count == 0)
                {
                    continue;
                }

                int index = 0;
                while (detail.AMOUNT > 0)
                {
                    if (index > stockList.Count - 1)
                    {
                        break;
                    }

                    detail.AMOUNT = detail.AMOUNT - Convert.ToInt32(stockList[0].MainAmount);

                    //更新库存
                    stockList[index].MainAmount    = 0;
                    stockList[index].ProductAmount = 0;

                    bill.Details.Add(new UseMatDetail
                    {
                        PID        = Guid.NewGuid().ToString(),
                        USEID      = bill.PID,
                        SaveSite   = stockList[index].SaveSite,
                        MatBarCode = stockList[index].MatBarCode,
                        MATRIALID  = stockList[index].MatID,
                        AMOUNT     = stockList[index].MainAmount,
                        Unit       = stockList[index].Unit
                    });

                    index++;
                }
            }

            this.Insert(bill);

            return(bill);
        }