protected void btnUpload_Click(object sender, EventArgs e)
 {
     try
     {
         this.btQtyHidden.Value = string.Empty;
         this.btSeqHidden.Value = string.Empty;
         if (this.rbType.SelectedValue == BusinessConstants.CODE_MASTER_TIME_PERIOD_TYPE_VALUE_DAY)
         {
             var productionPlanMstr = TheGenericMgr.FindAllWithCustomQuery <ProductionPlanMstr>(" select s from ProductionPlanMstr as s where s.ReleaseNo=? ", currentRelesNo).First();
             if (productionPlanMstr.Status == BusinessConstants.CODE_MASTER_BINDING_TYPE_VALUE_SUBMIT)
             {
                 throw new BusinessErrorException("已释放的生产计划不能导入。");
             }
             TheMrpMgr.ReadProductionPlanFromXls(fileUpload.PostedFile.InputStream, this.CurrentUser, productionPlanMstr);
             ShowSuccessMessage("导入成功。");
             this.btnSearch_Click(null, null);
         }
         else
         {
             throw new BusinessErrorException("只能导入日计划。");
         }
     }
     catch (BusinessErrorException ex)
     {
         ShowErrorMessage(ex);
     }
 }
Beispiel #2
0
 protected void btnImport_Click(object sender, EventArgs e)
 {
     try
     {
         var dateType = this.rblDateType.SelectedValue;
         if (dateType == "ShipPlan")
         {
             TheMrpMgr.ReadShipPlanParametersFromXls(fileUpload.PostedFile.InputStream, this.CurrentUser);
         }
         else if (dateType == "ProductionPlan")
         {
             TheMrpMgr.ReadProductionPlanParametersFromXls(fileUpload.PostedFile.InputStream, this.CurrentUser);
         }
         else if (dateType == "PurchasePlan")
         {
             TheMrpMgr.ReadPurchasePlanParametersFromXls(fileUpload.PostedFile.InputStream, this.CurrentUser);
         }
         ShowSuccessMessage("导入成功。");
     }
     catch (com.Sconit.Entity.Exception.BusinessErrorException ex)
     {
         ShowErrorMessage(ex);
     }
     catch (Exception et)
     {
         ShowErrorMessage(et.Message);
     }
 }
Beispiel #3
0
 protected void MRP_onclick(object sender, EventArgs e)
 {
     try
     {
         TheMrpMgr.RunMrp(this.CurrentUser);
     }
     catch (BusinessErrorException ex)
     {
         this.ShowErrorMessage(ex);
     }
 }
Beispiel #4
0
    protected void btnImport_Click(object sender, EventArgs e)
    {
        try
        {
            var dateType         = this.rblDateType.SelectedValue;
            var customerPlanList = TheMrpMgr.ReadCustomerPlanFromXls(fileUpload.PostedFile.InputStream, dateType, this.CurrentUser);

            ShowSuccessMessage("导入成功。");
        }
        catch (com.Sconit.Entity.Exception.BusinessErrorException ex)
        {
            ShowErrorMessage(ex);
        }
        catch (Exception et)
        {
            ShowErrorMessage(et.Message);
        }
    }
 protected void btnRunProdPlan_Click(object sender, EventArgs e)
 {
     try
     {
         TheMrpMgr.RunProductionPlan(this.CurrentUser);
         ShowSuccessMessage("生成成功。");
     }
     catch (BusinessErrorException ex)
     {
         ShowErrorMessage(ex);
     }
     catch (SqlException ex)
     {
         ShowErrorMessage(ex.Message);
     }
     catch (Exception ee)
     {
         ShowErrorMessage(ee.Message);
     }
 }
Beispiel #6
0
 protected void btnRunPurchasePlan_Click2(object sender, EventArgs e)
 {
     try
     {
         TheMrpMgr.RunMrp2(this.CurrentUser);
         ShowSuccessMessage("生成成功。");
     }
     catch (BusinessErrorException ex)
     {
         ShowErrorMessage(ex);
     }
     catch (SqlException ex)
     {
         ShowErrorMessage(ex.Message);
     }
     catch (Exception ee)
     {
         ShowErrorMessage(ee.Message);
     }
     this.showTimes.Style.Value = "display:none";
 }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            var            allSeqArr     = string.IsNullOrEmpty(this.btSeqHidden.Value) ? new string[0] : this.btSeqHidden.Value.Split(',');
            var            allShipQty    = string.IsNullOrEmpty(this.btQtyHidden.Value) ? new string[0] : this.btQtyHidden.Value.Split(',');
            string         allHtml       = this.list.InnerHtml;
            IList <string> itemList      = new List <string>();
            IList <string> qtyList       = new List <string>();
            IList <string> idList        = new List <string>();
            IList <string> releaseNoList = new List <string>();
            IList <string> dateFromList  = new List <string>();

            string item      = string.Empty;
            string qty       = string.Empty;
            string id        = string.Empty;
            string releaseNo = string.Empty;
            string dateFrom  = string.Empty;
            string seq       = string.Empty;
            while (allHtml.Length > 0)
            {
                //int startIndex = allHtml.IndexOf("flow='");
                //if (startIndex == -1) { allHtml = string.Empty; break; }
                //allHtml = allHtml.Substring(startIndex + 6);
                //int endIndex = allHtml.IndexOf("'");
                //flow = allHtml.Substring(0, endIndex);

                int startIndex = allHtml.IndexOf("item='");
                if (startIndex == -1)
                {
                    allHtml = string.Empty; break;
                }
                allHtml = allHtml.Substring(startIndex + 6);
                int endIndex = allHtml.IndexOf("'");
                item = allHtml.Substring(0, endIndex);

                startIndex = allHtml.IndexOf("id='");
                allHtml    = allHtml.Substring(startIndex + 4);
                endIndex   = allHtml.IndexOf("'");
                id         = allHtml.Substring(0, endIndex);

                startIndex = allHtml.IndexOf("value='");
                allHtml    = allHtml.Substring(startIndex + 7);
                endIndex   = allHtml.IndexOf("'");
                qty        = allHtml.Substring(0, endIndex);

                startIndex = allHtml.IndexOf("releaseNo='");
                allHtml    = allHtml.Substring(startIndex + 11);
                endIndex   = allHtml.IndexOf("'");
                releaseNo  = allHtml.Substring(0, endIndex);

                startIndex = allHtml.IndexOf("dateFrom='");
                allHtml    = allHtml.Substring(startIndex + 10);
                endIndex   = allHtml.IndexOf("'");
                dateFrom   = allHtml.Substring(0, endIndex);

                startIndex = allHtml.IndexOf("seq='");
                allHtml    = allHtml.Substring(startIndex + 5);
                endIndex   = allHtml.IndexOf("'");
                seq        = allHtml.Substring(0, endIndex);
                if (allSeqArr.Contains(seq))
                {
                    int i = 0;
                    foreach (var s in allSeqArr)
                    {
                        i++;
                        if (s == seq)
                        {
                            break;
                        }
                    }
                    if (allShipQty[i - 1] == qty)
                    {
                    }
                    else
                    {
                        //flowList.Add(flow);
                        itemList.Add(item);
                        idList.Add(id);
                        qtyList.Add(allShipQty[i - 1]);
                        releaseNoList.Add(releaseNo);
                        dateFromList.Add(dateFrom);
                    }
                }
            }
            IList <decimal> shipQtyList = new List <decimal>();
            foreach (var q in qtyList)
            {
                try
                {
                    shipQtyList.Add(Convert.ToDecimal(q));
                }
                catch (Exception exc)
                {
                    ShowErrorMessage("数量" + q + "填写错误");
                }
            }
            if (itemList.Count == 0)
            {
                ShowErrorMessage("没有要修改的计划。");
            }
            TheMrpMgr.UpdateProductionPlanQty(itemList, idList, shipQtyList, releaseNoList, dateFromList, this.CurrentUser, this.rbType.SelectedValue);
            ShowSuccessMessage("修改成功。");
            this.btnSearch_Click(null, null);
        }
        catch (BusinessErrorException ex)
        {
            ShowErrorMessage(ex);
        }
        catch (Exception ex)
        {
            ShowErrorMessage(ex.Message);
        }
        this.btQtyHidden.Value = string.Empty;
        this.btSeqHidden.Value = string.Empty;
    }