Esempio n. 1
0
    protected void btnSave_ServerClick(Object sender, EventArgs e)
    {
        ModelWeightDef item = new ModelWeightDef();

        item.UnitWeight = this.dStandardWeight.Text.Trim();
        item.Model= this.dModel.Text.Trim();
        item.Editor = this.HiddenUserName.Value;

        try
        {
            iModelWeight.SaveModelWeightItem(item);
        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            return;
        }
        catch (Exception ex)
        {
            //show error
            showErrorMessage(ex.Message);
            return;
        }

        ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "saveUpdate", "SaveComplete('True');DealHideWait();", true);
    }
Esempio n. 2
0
    protected void btnGetUnitWeight_ServerClick(Object sender, EventArgs e)
    {
        string model = this.dModel.Text.Trim().ToUpper();
        string weightNum = "";
		ModelWeightDef item = new ModelWeightDef();
        try
        {
            ArrayList arr = iModelWeight.GetModelWeightByModelorCustSN(model);
            item = (ModelWeightDef)arr[0];
            weightNum = item.UnitWeight;
            //IList<string> prdLst = (IList<string>)arr[1];
            hidMessage.Value = "";
           
            this.Hidd_Model.Value = item.Model;

            if (string.IsNullOrEmpty(weightNum))
            {
                getUnitWeightComplete("False", weightNum, "");
            }
            else
            {
                //if (prdLst.Count > 0)
                //{
                //    IList<string> proIdLst = (IList<string>)arr[1];
                //    hid_PrdLsit.Value = string.Join(",", proIdLst.ToArray());
                //    string m = "Total passed machines :" + prdLst.Count + " sets";
                //    getUnitWeightComplete("True", weightNum, "HaveHold('" + m + "')");
                //}
                //else
                //{
                //    getUnitWeightComplete("True", weightNum, "NoHold()");
                //}
                getUnitWeightComplete("True", weightNum, "NoHold()");
            }



        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            initPage();
          return;
        }
        catch (Exception ex)
        {
            showErrorMessage(ex.Message);
            initPage();
            return;
        }
     

    }
Esempio n. 3
0
        public void SaveModelWeightItem(ModelWeightDef item)
        {
            
            try
            {

                IModelWeightRepository itemRepositoryModelWeight = RepositoryFactory.GetInstance().GetRepository<IModelWeightRepository>();
                //看取得的数据是否有, 防止update的是空记录,但[PAK_SkuMasterWeight_FIS]中加入了记录
                DataTable modelWeight = itemRepositoryModelWeight.GetModelWeightItem(item.Model);
                if (modelWeight == null || modelWeight.Rows.Count == 0)
                {
                    //该Model尚无标准重量,请先去称重。
                    List<string> erpara = new List<string>();
                    FisException ex;
                    ex = new FisException("DMT149", erpara);
                    throw ex;
                }

                IPizzaRepository itemRepositoryPizza = RepositoryFactory.GetInstance().GetRepository<IPizzaRepository>();

                ModelWeightInfo setValue =new ModelWeightInfo();
                setValue.unitWeight = Decimal.Parse(item.UnitWeight);
                setValue.sendStatus = "";
                setValue.remark = "";
                setValue.editor = item.Editor;
                setValue.udt = DateTime.Now;

                ModelWeightInfo condition =new ModelWeightInfo();
                condition.model = item.Model;

                PakSkuMasterWeightFisInfo pakSkuMasterWeight = new PakSkuMasterWeightFisInfo();
                pakSkuMasterWeight.model = item.Model;
                pakSkuMasterWeight.weight = setValue.unitWeight;
                pakSkuMasterWeight.cdt = setValue.udt;

                UnitOfWork uow = new UnitOfWork();
                itemRepositoryModelWeight.UpdateModelWeightDefered(uow,setValue,condition);
                itemRepositoryPizza.DeletetPakSkuMasterWeightFisByModelDefered(uow, item.Model);
                itemRepositoryPizza.InsertPakSkuMasterWeightFisDefered(uow, pakSkuMasterWeight);
                uow.Commit();

            }
            catch (Exception)
            {
                throw;
            }

        }
Esempio n. 4
0
    protected void btnGetUnitWeight_ServerClick(Object sender, EventArgs e)
    {
        string model = this.dModel.Text.Trim().ToUpper();
        string weightNum = "";
		ModelWeightDef item = new ModelWeightDef();
        try
        {
            item=iModelWeight.GetModelWeightByModelorCustSN(model);
			weightNum =item.UnitWeight;
            this.Hidd_Model.Value = item.Model;

            if (string.IsNullOrEmpty(weightNum))
            {
                getUnitWeightComplete("False", weightNum);
            }
            else getUnitWeightComplete("True",weightNum);

        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            initPage();
                        
          //  ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "GetUnitWeight", "GetUnitWeightComplete('False','');DealHideWait();", true);
            
            return;
        }
        catch (Exception ex)
        {

            showErrorMessage(ex.Message);
            initPage();
           // ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "GetUnitWeight", "GetUnitWeightComplete('False','');DealHideWait();", true);
            return;
        }
       //   ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "GetUnitWeight", "GetUnitWeightComplete('True','" + weightNum + "');DealHideWait();", true);

    }
Esempio n. 5
0
    protected void btnSave_ServerClick(Object sender, EventArgs e)
    {
      

        try
        {
            ModelWeightDef curitem = new ModelWeightDef();

            if (string.IsNullOrEmpty(this.Hidd_Model.Value.Trim()))
            {
                string model = this.dModel.Text.Trim().ToUpper();
                ArrayList arr = iModelWeight.GetModelWeightByModelorCustSN(model);
                curitem.Model = ((ModelWeightDef)arr[0]).Model;

                this.Hidd_Model.Value = curitem.Model;
            }
            else
            {
                curitem.Model = this.Hidd_Model.Value.Trim();
            }

            curitem.UnitWeight = this.dStandardWeight.Text.Trim();
            //curitem.Model = this.Hidd_Model.Value.Trim();
            curitem.Editor = Master.userInfo.UserId;

         iModelWeight.SaveModelWeightItem(curitem);
         
            saveComplete();
        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            initPage();
            
        }
        catch (Exception ex)
        {
            showErrorMessage(ex.Message);
            initPage();
        }
        finally
        {
            EndWaitingCoverDiv();
        }
      
    }
Esempio n. 6
0
    protected void btnHoldAndSave_ServerClick(Object sender, EventArgs e)
    {

        ModelWeightDef curitem = new ModelWeightDef();
     
        curitem.UnitWeight = this.dStandardWeight.Text.Trim();
        if (string.IsNullOrEmpty(this.Hidd_Model.Value.Trim()))
        {
            string model = this.dModel.Text.Trim().ToUpper();
            ArrayList arr = iModelWeight.GetModelWeightByModelorCustSN(model);
            curitem.Model = ((ModelWeightDef)arr[0]).Model;

            this.Hidd_Model.Value = curitem.Model;
        }
        else
        {
            curitem.Model = this.Hidd_Model.Value.Trim();
        }
        curitem.Editor = Master.userInfo.UserId;

        try
        {


            IList<string> lst = (IList<string>)hid_PrdLsit.Value.Split(',').ToList();
            string defect = hidDefect.Value;
            iModelWeight.SaveModelWeightItemAndHold(curitem, lst, "HOLD", defect);
            saveComplete();
        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            initPage();

        }
        catch (Exception ex)
        {
            showErrorMessage(ex.Message);
            initPage();
        }
        finally
        { 
        EndWaitingCoverDiv();
        }

    }
Esempio n. 7
0
    protected void btnSave_ServerClick(Object sender, EventArgs e)
    {
        ModelWeightDef curitem = new ModelWeightDef();

        curitem.UnitWeight = this.dStandardWeight.Text.Trim();
        curitem.Model = this.Hidd_Model.Value.Trim();
        curitem.Editor = Master.userInfo.UserId;

        try
        {
            iModelWeight.SaveModelWeightItem(curitem);

            saveComplete();
        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            initPage();
            
        }
        catch (Exception ex)
        {
            showErrorMessage(ex.Message);
            initPage();
        }

      //  ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "saveUpdate", "SaveComplete('True');DealHideWait();", true);
    }
Esempio n. 8
0
        /// <summary>
        /// 获取ModelWeight
        /// </summary>
        /// <param name="inputData">inputData</param>
        /// <returns></returns>
        public ArrayList GetModelWeightByModelorCustSN(string inputData)
        {
            //检查合法model
            //看取得的数据是否有数据
            String result = "";
            try
            {
                string model = string.Empty;
                IModelRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IModelRepository>();


                //3)	如果刷入为10位,如果是CN打头的初步认定为Customer SN,如在Product.CustSN中不存在,则提示“非法的Customer SN”
                if (inputData.Length == 10 && (inputData.Substring(0, 2) == "CN"||inputData.Substring(0, 2) == "5C"))
                {
                    var currentProduct = CommonImpl.GetProductByInput(inputData, CommonImpl.InputTypeEnum.CustSN);
                    if (currentProduct == null)
                    {
                        FisException fe = new FisException("PAK042", new string[] { inputData });  //此Customer S/N %1 不存在!
                        throw fe;
                    }
                    else if (string.IsNullOrEmpty(currentProduct.Model))
                    {
                        FisException fe = new FisException("PAK028", new string[] { inputData });  //该Customer SN %1 还未与Model绑定!
                        throw fe;
                    }
                    //else if (!currentProduct.ProductLogs.Where(x => x.Station == "PKCK" && x.Status == StationStatus.Pass).Any())
                    //{
                    //    FisException fe = new FisException("PAK185");  //该Customer SN %1 还未与Model绑定!
                    //    throw fe;
                    //}
                    else model = currentProduct.Model;
                    IList<ProductLog> productLogList = currentProduct.ProductLogs.OrderBy(p => p.Cdt).ToList();
                    int count = productLogList.Count;
                    if (count > 0)
                    {
                        ProductLog lastProductLog = productLogList[count - 1];
                        if (!(lastProductLog.Station == "PKCK" && lastProductLog.Status == StationStatus.Pass))
                        {
                            FisException fe = new FisException("PAK185", new string[] { inputData });  //该Customer SN 为sorting!
                            throw fe;
                        }
                    }
                    
                }
                else
                {
                    Model modelItem = itemRepository.Find(inputData);
                    if (modelItem == null)
                    {
                        var currentProduct = CommonImpl.GetProductByInput(inputData, CommonImpl.InputTypeEnum.CustSN);
                        if (currentProduct == null || string.IsNullOrEmpty(currentProduct.Model))
                        {
                            FisException fe = new FisException("CHK079", new string[] { inputData });   //找不到与此序号 %1 匹配的Product! 
                            throw fe;
                        }
                        else model = currentProduct.Model;

                    }
                    else model = inputData;

                }

                IModelWeightRepository itemRepositoryModelWeight = RepositoryFactory.GetInstance().GetRepository<IModelWeightRepository>();

                DataTable modelWeight = itemRepositoryModelWeight.GetModelWeightItem(model);
                //if (modelWeight == null || modelWeight.Rows.Count == 0)
                //{
                //    //This Model, there is no standard weight, please go to the weighing.
                //    //该Model尚无标准重量,请先去称重。
                //    List<string> erpara = new List<string>();
                //    erpara.Add(model);
                //    FisException ex;
                //    ex = new FisException("PAK123", erpara);
                //    throw ex;
                //}

                if (modelWeight == null || modelWeight.Rows.Count == 0)
                {
                    result = "0.00";
                }
                else
                {
                    result = modelWeight.Rows[0][1].ToString();
                }
                //if (result == "")
                //{
                //    //该Model尚无标准重量,请先去称重。
                //    List<string> erpara = new List<string>();
                //    erpara.Add(model);
                //    FisException ex;
                //    ex = new FisException("PAK123", erpara);
                //    throw ex;
                //}

                ModelWeightDef item = new ModelWeightDef();
                item.Model = model;
                item.UnitWeight = result;

                //IList<string> ls2= GetPrIDListInHoldByModel(model);
                ArrayList arr = new ArrayList();
                arr.Add(item);
                //arr.Add(ls2);
                return arr;
            }
            catch (FisException e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw new SystemException(e.Message);
            }


        }
Esempio n. 9
0
 private void HoldProductByProductList(IList<string> lstPrdID, ModelWeightDef item, IUnitOfWork uow, string holdStation)
 {
     try
     {
         IProductRepository prodyctRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
         prodyctRep.UpdateProductPreStationDefered(uow, lstPrdID);
         prodyctRep.UpdateProductStatusDefered(uow, lstPrdID, "", holdStation, 0, 0, item.Editor);
         prodyctRep.WriteProductLogDefered(uow, lstPrdID, "", holdStation, 0, item.Editor);
   
     }
     catch (FisException e)
     {
         throw e;
     }
     catch (Exception e)
     {
         throw new SystemException(e.Message);
     }
 
  
 }
Esempio n. 10
0
        public void SaveModelWeightItemAndHold(ModelWeightDef item, IList<string> lstPrdID, string holdStation, string defectCode)
        {
            try
            {

                IModelWeightRepository itemRepositoryModelWeight = RepositoryFactory.GetInstance().GetRepository<IModelWeightRepository>();
                //看取得的数据是否有, 防止update的是空记录,但[PAK_SkuMasterWeight_FIS]中加入了记录
                DataTable modelWeight = itemRepositoryModelWeight.GetModelWeightItem(item.Model);
                //if (modelWeight == null || modelWeight.Rows.Count == 0)
                //{
                //    //该Model尚无标准重量,请先去称重。
                //    List<string> erpara = new List<string>();
                //    erpara.Add(item.Model);
                //    FisException ex;
                //    ex = new FisException("PAK123", erpara);
                //    throw ex;
                //}
                if (modelWeight == null || modelWeight.Rows.Count == 0)
                {
                    item.UnitWeight = "0.00";
                }
                else
                {
                    item.UnitWeight = modelWeight.Rows[0][1].ToString();
                }

                IPizzaRepository itemRepositoryPizza = RepositoryFactory.GetInstance().GetRepository<IPizzaRepository>();

                ModelWeightInfo setValue = new ModelWeightInfo();
                setValue.unitWeight = Decimal.Parse(item.UnitWeight);
                setValue.sendStatus = "";
                setValue.remark = "";
                setValue.editor = item.Editor;

                setValue.udt = DateTime.Now;

                ModelWeightInfo condition = new ModelWeightInfo();
                condition.model = item.Model;

                PakSkuMasterWeightFisInfo pakSkuMasterWeight = new PakSkuMasterWeightFisInfo();
                pakSkuMasterWeight.model = item.Model;
                pakSkuMasterWeight.weight = setValue.unitWeight;                
                pakSkuMasterWeight.cdt = setValue.udt;

                UnitOfWork uow = new UnitOfWork();
                itemRepositoryModelWeight.UpdateModelWeightDefered(uow, setValue, condition);
                itemRepositoryPizza.DeletetPakSkuMasterWeightFisByModelDefered(uow, item.Model);
                itemRepositoryPizza.InsertPakSkuMasterWeightFisDefered(uow, pakSkuMasterWeight);
                HoldProductByProductList(lstPrdID, item, uow,holdStation);
             
             //void WriteHoldCodeDefered(IUnitOfWork uow, IList<string> productIDList, TestLog log, IList<string> defectList);
                TestLog testLog = new TestLog(0, "", "", "", "HOLD", TestLog.TestLogStatus.Fail, "", "HOLD", "", "", item.Editor, "HOLD", DateTime.Now);
                IProductRepository prodyctRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
                IList<string> defectLst = new List<string>();
                defectLst.Add(defectCode);
                prodyctRep.WriteHoldCodeDefered(uow, lstPrdID, testLog, defectLst);
                uow.Commit();

            }
            catch (FisException e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw new SystemException(e.Message);
            }
        
        }
Esempio n. 11
0
        /// <summary>
        /// 保存修改的ModelWeight
        /// </summary>
        /// <param name="item">item</param>
        /// <returns></returns>
        public void SaveModelWeightItem(ModelWeightDef item)
        {
            
            try
            {

                IModelWeightRepository itemRepositoryModelWeight = RepositoryFactory.GetInstance().GetRepository<IModelWeightRepository>();
                ////看取得的数据是否有, 防止update的是空记录,但[PAK_SkuMasterWeight_FIS]中加入了记录
                //DataTable modelWeight = itemRepositoryModelWeight.GetModelWeightItem(item.Model);
                ////if (modelWeight == null || modelWeight.Rows.Count == 0)
                ////{
                ////    //该Model尚无标准重量,请先去称重。
                ////    List<string> erpara = new List<string>();
                ////    erpara.Add(item.Model);
                ////    FisException ex;
                ////    ex = new FisException("PAK123", erpara);
                ////    throw ex;
                ////}
                //if (modelWeight == null || modelWeight.Rows.Count == 0 || item.UnitWeight == "0.00")
                //{
                //    item.UnitWeight = "0.00";
                //}
                //else if (item.UnitWeight != "0.00")
                //{ 
                    
                //}
                //else
                //{
                //    item.UnitWeight = modelWeight.Rows[0][1].ToString();
                //}
                if (string.IsNullOrEmpty(item.Model))
                {
                    //该Model尚无标准重量,请先去称重。
                    List<string> erpara = new List<string>();
                    erpara.Add("Model");
                    FisException ex;
                    ex = new FisException("CQCHK0006", erpara);
                    throw ex;
                }

                decimal  inputUnitweight =decimal.Parse(item.UnitWeight);
                if (inputUnitweight == 0)
                {
                    //该Model尚无标准重量,请先去称重。
                        List<string> erpara = new List<string>();
                        erpara.Add(item.Model);
                        FisException ex;
                        ex = new FisException("CQCHK0048", erpara);
                        throw ex;
                }

                IModelWeightRepository currentModelWeightRepository = RepositoryFactory.GetInstance().GetRepository<IModelWeightRepository>();
                IMES.FisObject.PAK.StandardWeight.ModelWeight currentModelWeight = currentModelWeightRepository.Find(item.Model);
                bool isAdd = false;
                if (currentModelWeight == null)
                {
                    currentModelWeight = new IMES.FisObject.PAK.StandardWeight.ModelWeight();
                    //每次手動修改標準重需將ModelWeight.Remark='New',在10分鐘後送給SAP Unitweight
                    currentModelWeight.Remark = "New";
                    isAdd = true;
                }
                else
                {
                    if (!string.IsNullOrEmpty(currentModelWeight.SendStatus))
                    {
                        currentModelWeight.Remark = currentModelWeight.UnitWeight.ToString();
                    }
                }

                

                currentModelWeight.Model = item.Model;
                //currentModelWeight.UnitWeight = Decimal.Parse(item.UnitWeight);
                currentModelWeight.UnitWeight = inputUnitweight;
                currentModelWeight.SendStatus = "";
                currentModelWeight.Editor = item.Editor;
                currentModelWeight.Udt = DateTime.Now;

                IPizzaRepository itemRepositoryPizza = RepositoryFactory.GetInstance().GetRepository<IPizzaRepository>();

                //ModelWeightInfo setValue =new ModelWeightInfo();
                //setValue.unitWeight = Decimal.Parse(item.UnitWeight);
                //setValue.editor = item.Editor;
                //setValue.udt = DateTime.Now;

                //ModelWeightInfo condition =new ModelWeightInfo();
                //condition.model = item.Model;

                PakSkuMasterWeightFisInfo pakSkuMasterWeight = new PakSkuMasterWeightFisInfo();
                pakSkuMasterWeight.model = item.Model;
                //pakSkuMasterWeight.weight = setValue.unitWeight;               
                //pakSkuMasterWeight.cdt = setValue.udt;
                pakSkuMasterWeight.weight = inputUnitweight;
                pakSkuMasterWeight.cdt = currentModelWeight.Udt; 

                UnitOfWork uow = new UnitOfWork();
                //itemRepositoryModelWeight.UpdateModelWeightDefered(uow,setValue,condition);
                itemRepositoryPizza.DeletetPakSkuMasterWeightFisByModelDefered(uow, item.Model);
                itemRepositoryPizza.InsertPakSkuMasterWeightFisDefered(uow, pakSkuMasterWeight);
                if (isAdd)
                {
                    currentModelWeightRepository.Add(currentModelWeight, uow);
                }
                else
                {
                    currentModelWeightRepository.Update(currentModelWeight, uow);
                }
                
                
                uow.Commit();

            }
            catch (FisException e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw new SystemException(e.Message);
            }
        }
Esempio n. 12
0
        /// <summary>
        /// 获取ModelWeight
        /// </summary>
        /// <param name="inputData">inputData</param>
        /// <returns></returns>
        public ModelWeightDef GetModelWeightByModelorCustSN(string inputData)
        {
            //检查合法model
            //看取得的数据是否有数据
            String result = "";
            try
            {
                string model = string.Empty;
                IModelRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IModelRepository>();


                //3)	如果刷入为10位,如果是CN打头的初步认定为Customer SN,如在Product.CustSN中不存在,则提示“非法的Customer SN”
                //if (inputData.Length == 10 && inputData.Substring(0, 2) == "CN")
                if (CommonImpl.CheckCustSNPreFix2(inputData))
                {
                    var currentProduct = CommonImpl.GetProductByInput(inputData, CommonImpl.InputTypeEnum.CustSN);
                    if (currentProduct == null)
                    {
                        FisException fe = new FisException("PAK042", new string[] { inputData });  //此Customer S/N %1 不存在!
                        throw fe;
                    }
                    else if (string.IsNullOrEmpty(currentProduct.Model))
                    {
                        FisException fe = new FisException("PAK028", new string[] { inputData });  //该Customer SN %1 还未与Model绑定!
                        throw fe;
                    }
                    else model = currentProduct.Model;
                }
                else
                {
                    Model modelItem = itemRepository.Find(inputData);
                    if (modelItem == null)
                    {
                        var currentProduct = CommonImpl.GetProductByInput(inputData, CommonImpl.InputTypeEnum.CustSN);
                        if (currentProduct == null || string.IsNullOrEmpty(currentProduct.Model))
                        {
                            FisException fe = new FisException("CHK079", new string[] { inputData });   //找不到与此序号 %1 匹配的Product! 
                            throw fe;
                        }
                        else model = currentProduct.Model;

                    }
                    else model = inputData;

                }

                IModelWeightRepository itemRepositoryModelWeight = RepositoryFactory.GetInstance().GetRepository<IModelWeightRepository>();

                DataTable modelWeight = itemRepositoryModelWeight.GetModelWeightItem(model);
                if (modelWeight == null || modelWeight.Rows.Count == 0)
                {
                    //This Model, there is no standard weight, please go to the weighing.
                    //该Model尚无标准重量,请先去称重。
                    List<string> erpara = new List<string>();
                    erpara.Add(model);
                    FisException ex;
                    ex = new FisException("PAK123", erpara);
                    throw ex;
                }

                result = modelWeight.Rows[0][1].ToString();

                if (result == "")
                {
                    //该Model尚无标准重量,请先去称重。
                    List<string> erpara = new List<string>();
                    erpara.Add(model);
                    FisException ex;
                    ex = new FisException("PAK123", erpara);
                    throw ex;
                }

                ModelWeightDef item = new ModelWeightDef();
                item.Model = model;
                item.UnitWeight = result;
                return item;
            }
            catch (FisException e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw new SystemException(e.Message);
            }

        }