/// <summary> /// 获取DN表相关信息GetDeliveryPalletListByDN /// </summary> public IList<S_RowData_DN> GetDNList() { logger.Debug("(_CombineDNPalletforBT)GetDNList start."); try { IList<S_RowData_DN> ret = new List<S_RowData_DN>(); DNQueryCondition condition = new DNQueryCondition(); DateTime temp = DateTime.Now; temp = temp.AddDays(-3); condition.ShipDateFrom = new DateTime(temp.Year, temp.Month, temp.Day, 0, 0, 0, 0); IList<DNForUI> dnList = currentRepository.GetDNListByCondition(condition); foreach (DNForUI tmp in dnList) { S_RowData_DN ele = new S_RowData_DN(); ele.DeliveryNO = tmp.DeliveryNo; if (tmp.Status != "00") { continue; } if (!(tmp.ModelName.Length == 12 && tmp.ModelName.Substring(0, 2) == "PC")) { continue; } ele.Model = tmp.ModelName; ele.CustomerPN = currentRepository.GetDeliveryInfoValue(tmp.DeliveryNo, "PartNo"); ele.PoNo = tmp.PoNo; ele.Date = tmp.ShipDate.ToString(); ele.Qty = tmp.Qty.ToString(); IList<IProduct> productList = new List<IProduct>(); productList = productRepository.GetProductListByDeliveryNo(tmp.DeliveryNo); if (null != productList) { ele.PackedQty = productList.Count.ToString(); } ret.Add(ele); } return ret; } catch (FisException e) { logger.Error(e.mErrmsg, e); throw new Exception(e.mErrmsg); } catch (Exception e) { logger.Error(e.Message, e); throw new SystemException(e.Message); } finally { logger.Debug("(_CombineDNPalletforBT)GetDNList end."); } }
private Delivery GetNextDelivery(Product curProduct) { IProductRepository productRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>(); IDeliveryRepository deliveryRep = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>(); IModelRepository modelRep = RepositoryFactory.GetInstance().GetRepository<IModelRepository, Model>(); IMORepository moRep = RepositoryFactory.GetInstance().GetRepository<IMORepository>(); Delivery assignDelivery = new Delivery(); CurrentSession.AddValue("HasDN", "N"); //CDSI 机器Assign Delivery的特殊要求 //IList<IMES.FisObject.Common.Model.ModelInfo> GetModelInfoByModelAndName(string model, string name); IList<IMES.FisObject.Common.Model.ModelInfo> infoList = modelRep.GetModelInfoByModelAndName(curProduct.Model, "PO"); Model model = modelRep.Find(curProduct.Model); string cdsi = ""; cdsi = model.GetAttribute("PO"); if (cdsi != "Y") { cdsi = ""; cdsi = model.GetAttribute("ATSNAV"); if (!string.IsNullOrEmpty(cdsi)) { cdsi = "cdsi"; } } else { cdsi = "cdsi"; } CurrentSession.AddValue("CDSI", cdsi); if (cdsi == "cdsi") { if (!string.IsNullOrEmpty(curProduct.DeliveryNo)) { assignDelivery = deliveryRep.Find(curProduct.DeliveryNo); CurrentSession.AddValue(Session.SessionKeys.Delivery, assignDelivery); return assignDelivery; } string factoryPo = ""; //获取Product 结合的Factory Po,对于CDSI 机器如果获取不到结合的Factory Po, //需要报告错误:“CDSI AST MISSING DATA!” //SELECT @FactoryPo = Sno FROM CDSIAST NOLOCK WHERE SnoId = @ProductId AND Tp = 'FactoryPO' CdsiastInfo conf = new CdsiastInfo(); conf.snoId = curProduct.ProId; conf.tp = "FactoryPO"; IList<CdsiastInfo> cdsiList = productRep.GetCdsiastInfoList(conf); /*if (cdsiList.Count == 0) { errpara.Add(this.Key); throw new FisException("PAK140", errpara);//“CDSI AST MISSING DATA!” }*/ factoryPo = cdsiList[0].sno; IList<Delivery> dnList = deliveryRep.GetDeliveryListByModelPrefix(factoryPo, "PC", 12, "00"); //IF @Delivery = '' SELECT 'CDSI 机器,无此PoNo: ' + @FactoryPo + ' 的Delivery!' if (dnList.Count == 0) { return null; } assignDelivery = dnList[0]; } else if (curProduct.IsBindedPo) { if (!string.IsNullOrEmpty(curProduct.DeliveryNo)) { assignDelivery = deliveryRep.Find(curProduct.DeliveryNo); CurrentSession.AddValue(Session.SessionKeys.Delivery, assignDelivery); return assignDelivery; } string factoryPo = curProduct.BindPoNo; IList<Delivery> dnList = deliveryRep.GetDeliveryListByModelPrefix(factoryPo, "PC", 12, "00"); if (dnList.Count == 0) { return null; } assignDelivery = dnList[0]; } else if (!curProduct.IsBT) { //a)选择的DN需要满足如下要求: //Delivery.ShipDate 大于3天前 (例如:当天为2011/9/13,那么获取的DN 的ShipDate 要大于2011/9/10) – 即ShipDate>=convert(char(10),getdate()-3,111) //Note: //ShipDate 需要转换为YYYY/MM/DD 格式显示 //Sample: 2009/05/11 //Delivery.Status = ‘00’ //Delivery.Model 长度为12 位 //Delivery.Model 前两码为’PC’ //系统自动分配另外一个DN(列表中满足条件的Delivery按照ShipDate,Qty,DeliveryNo 排序取第一个), DNQueryCondition condition = new DNQueryCondition(); DateTime temp = DateTime.Now; temp = temp.AddDays(-3); condition.ShipDateFrom = new DateTime(temp.Year, temp.Month, temp.Day, 0, 0, 0, 0); condition.Model = curProduct.Model; IList<DNForUI> dnList = deliveryRep.GetDNListByConditionWithSorting(condition); //Vincent 2015-02-27 過濾綁訂PoDN if (dnList != null && dnList.Count > 0) { IList<string> bindPoNoList = moRep.GetBindPoNoByModel(curProduct.Model); if (bindPoNoList != null && bindPoNoList.Count > 0) { dnList = dnList.Where(x => !bindPoNoList.Contains(x.PoNo)).ToList(); } } foreach (DNForUI tmp in dnList) { if (tmp.Status != "00") { continue; } if (!(tmp.ModelName.Length == 12 && tmp.ModelName.Substring(0, 2) == "PC")) { continue; } int qty = 0; int packedQty = 0; qty = tmp.Qty; IList<IProduct> productList = new List<IProduct>(); productList = productRep.GetProductListByDeliveryNo(tmp.DeliveryNo); packedQty = productList.Count; if (packedQty + 1 > qty) { continue; } assignDelivery = deliveryRep.Find(tmp.DeliveryNo); break; } if (assignDelivery == null) { return null; } } return assignDelivery; }
/// <summary> /// Delivery 分配原则 /// </summary> /// <param name="executionContext"></param> /// <returns></returns> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { List<string> errpara = new List<string>(); Product curProduct = (Product)CurrentSession.GetValue(Session.SessionKeys.Product); IProductRepository productRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>(); IDeliveryRepository deliveryRep = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>(); IModelRepository modelRep = RepositoryFactory.GetInstance().GetRepository<IModelRepository, Model>(); /*IList<ProductBTInfo> btList = productRep.GetProductBT(curProduct.ProId); if (btList.Count > 0 && Station.Trim() == "92") { return base.DoExecute(executionContext); } */ Delivery assignDelivery = new Delivery(); CurrentSession.AddValue("HasDN", "N"); //CDSI 机器Assign Delivery的特殊要求 //IList<IMES.FisObject.Common.Model.ModelInfo> GetModelInfoByModelAndName(string model, string name); IList<IMES.FisObject.Common.Model.ModelInfo> infoList = modelRep.GetModelInfoByModelAndName(curProduct.Model, "PO"); Model model = modelRep.Find(curProduct.Model); string cdsi = ""; cdsi= model.GetAttribute("PO"); if (cdsi != "Y") { cdsi = ""; cdsi = model.GetAttribute("ATSNAV"); if (!string.IsNullOrEmpty(cdsi)) { cdsi = "cdsi"; } } else { cdsi = "cdsi"; } CurrentSession.AddValue("CDSI", cdsi); if (cdsi == "cdsi") { if (!string.IsNullOrEmpty(curProduct.DeliveryNo)) { assignDelivery = deliveryRep.Find(curProduct.DeliveryNo); CurrentSession.AddValue(Session.SessionKeys.Delivery, assignDelivery); CurrentSession.AddValue("HasDN", "Y"); return base.DoExecute(executionContext); } string factoryPo = ""; //获取Product 结合的Factory Po,对于CDSI 机器如果获取不到结合的Factory Po, //需要报告错误:“CDSI AST MISSING DATA!” //SELECT @FactoryPo = Sno FROM CDSIAST NOLOCK WHERE SnoId = @ProductId AND Tp = 'FactoryPO' CdsiastInfo conf = new CdsiastInfo(); conf.snoId = curProduct.ProId; conf.tp = "FactoryPO"; IList<CdsiastInfo> cdsiList = productRep.GetCdsiastInfoList(conf); if (cdsiList.Count == 0) { errpara.Add(this.Key); throw new FisException("PAK140", errpara);//“CDSI AST MISSING DATA!” } factoryPo = cdsiList[0].sno; IList<Delivery> dnList = deliveryRep.GetDeliveryListByModelPrefix(factoryPo, "PC", 12, "00"); //IF @Delivery = '' SELECT 'CDSI 机器,无此PoNo: ' + @FactoryPo + ' 的Delivery!' if (dnList.Count == 0) { errpara.Add(factoryPo); throw new FisException("PAK141", errpara);//'CDSI 机器,无此PoNo: ' + @FactoryPo + ' 的Delivery!' } assignDelivery = dnList[0]; curProduct.DeliveryNo = assignDelivery.DeliveryNo; } else if (!curProduct.IsBT) { //a)选择的DN需要满足如下要求: //Delivery.ShipDate 大于3天前 (例如:当天为2011/9/13,那么获取的DN 的ShipDate 要大于2011/9/10) – 即ShipDate>=convert(char(10),getdate()-3,111) //Note: //ShipDate 需要转换为YYYY/MM/DD 格式显示 //Sample: 2009/05/11 //Delivery.Status = ‘00’ //Delivery.Model 长度为12 位 //Delivery.Model 前两码为’PC’ //系统自动分配另外一个DN(列表中满足条件的Delivery按照ShipDate,Qty,DeliveryNo 排序取第一个), DNQueryCondition condition = new DNQueryCondition(); DateTime temp = DateTime.Now; temp = temp.AddDays(-3); condition.ShipDateFrom = new DateTime(temp.Year, temp.Month, temp.Day, 0, 0, 0, 0); condition.Model = curProduct.Model; IList<DNForUI> dnList = deliveryRep.GetDNListByConditionWithSorting(condition); foreach (DNForUI tmp in dnList) { if (tmp.Status != "00") { continue; } if (!(tmp.ModelName.Length == 12 && tmp.ModelName.Substring(0, 2) == "PC")) { continue; } //tmp.Editor = deliveryRep.GetDeliveryInfoValue(tmp.DeliveryNo, "PartNo");//CustomerPN int qty = 0; int packedQty = 0; qty = tmp.Qty; IList<IProduct> productList = new List<IProduct>(); productList = productRep.GetProductListByDeliveryNo(tmp.DeliveryNo); packedQty = productList.Count; if (packedQty+1 > qty) { continue; } assignDelivery = deliveryRep.Find(tmp.DeliveryNo); break; } if (assignDelivery == null) { FisException fe = new FisException("PAK103", new string[] { }); //没找到可分配的delivery throw fe; } curProduct.DeliveryNo = assignDelivery.DeliveryNo; } CurrentSession.AddValue(Session.SessionKeys.Delivery, assignDelivery); return base.DoExecute(executionContext); }
/// <summary> /// 获取DN表相关信息 /// </summary> public IList<S_RowData_COAandDN> GetDNListQuick(string model, string pono) { logger.Debug("(_CombineCOAandDN)GetDNListQuick start."); try { IList<S_RowData_COAandDN> ret = new List<S_RowData_COAandDN>(); if (model == "") { return ret; } if (pono == "") { Delivery assignDelivery = null; int assignQty = 0; IList<Delivery> deliveryList = currentRepository.GetDeliveryListByModel(model, "PC", 12, "00"); //a) ShipDate 越早,越优先 //b) 散装优先于非散装 //c) 剩余未包装Product数量越少的越优先 bool assignNA = false; foreach (Delivery dvNode in deliveryList) { int curqty = productRepository.GetCombinedQtyByDN(dvNode.DeliveryNo); int tmpqty = dvNode.Qty - curqty; int curQty = productRepository.GetCombinedQtyByDN(dvNode.DeliveryNo); if (tmpqty > 0) { bool naflag = false; foreach (DeliveryPallet dpNode in dvNode.DnPalletList) { if (dpNode.PalletID.Substring(0, 2) == "NA") { naflag = true; break; } } if (assignDelivery == null) { assignDelivery = dvNode; assignQty = tmpqty; assignNA = naflag; continue; } if (DateTime.Compare(assignDelivery.ShipDate, dvNode.ShipDate) < 0) { continue; } if (!assignNA && naflag) { assignDelivery = dvNode; assignQty = tmpqty; assignNA = naflag; } else if (assignNA == naflag) { if (tmpqty < assignQty) { assignDelivery = dvNode; assignQty = tmpqty; assignNA = naflag; } } } } if (assignDelivery == null) { FisException fe = new FisException("PAK103", new string[] { }); //没找到可分配的delivery throw fe; } S_RowData_COAandDN ele = new S_RowData_COAandDN(); ele.DeliveryNO = assignDelivery.DeliveryNo; ele.Model = assignDelivery.ModelName; ele.CustomerPN = currentRepository.GetDeliveryInfoValue(assignDelivery.DeliveryNo, "PartNo"); ele.PoNo = assignDelivery.PoNo; ele.Date = assignDelivery.ShipDate.ToString("yyyy/MM/dd"); ele.Qty = assignDelivery.Qty.ToString(); int qty = 0; int packedQty = 0; qty = assignDelivery.Qty; IList<IProduct> productList = new List<IProduct>(); productList = productRepository.GetProductListByDeliveryNo(assignDelivery.DeliveryNo); if (null != productList) { ele.PackedQty = productList.Count.ToString(); packedQty = productList.Count; } ret.Add(ele); } else { DNQueryCondition condition = new DNQueryCondition(); DateTime temp = DateTime.Now; temp = temp.AddDays(-3); condition.ShipDateFrom = new DateTime(temp.Year, temp.Month, temp.Day, 0, 0, 0, 0); condition.Model = model; IList<DNForUI> dnList = currentRepository.GetDNListByConditionWithSorting(condition); foreach (DNForUI tmp in dnList) { S_RowData_COAandDN ele = new S_RowData_COAandDN(); ele.DeliveryNO = tmp.DeliveryNo; if (tmp.Status != "00") { continue; } if (!(tmp.ModelName.Length == 12 && tmp.ModelName.Substring(0, 2) == "PC")) { continue; } ele.Model = tmp.ModelName; ele.CustomerPN = currentRepository.GetDeliveryInfoValue(tmp.DeliveryNo, "PartNo"); ele.PoNo = tmp.PoNo; if (pono != "") { if (pono != tmp.PoNo) { continue; } } ele.Date = tmp.ShipDate.ToString("yyyy/MM/dd"); ele.Qty = tmp.Qty.ToString(); int qty = 0; int packedQty = 0; qty = tmp.Qty; IList<IProduct> productList = new List<IProduct>(); productList = productRepository.GetProductListByDeliveryNo(tmp.DeliveryNo); if (null != productList) { ele.PackedQty = productList.Count.ToString(); packedQty = productList.Count; } if (packedQty > qty) { continue; } ret.Add(ele); break; } } return ret; } catch (FisException e) { logger.Error(e.mErrmsg, e); throw new Exception(e.mErrmsg); } catch (Exception e) { logger.Error(e.Message, e); throw new SystemException(e.Message); } finally { logger.Debug("(_CombineCOAandDN)GetDNListQuick end."); } }
/// <summary> /// 获取Product表相关信息 /// </summary> /// <param name="line">line</param> /// <param name="editor">editor</param> /// <param name="station">station</param> /// <param name="customer">customer</param> /// <param name="customerSN">customer SN</param> public S_RowData_Product GetProduct(string line, string editor, string station, string customer,string customerSN) { logger.Debug("(_CombineCOAandDN)GetProduct start.customerSN:" + customerSN); string keyStr = ""; try { string sessionKey = customerSN; keyStr = sessionKey; Session currentSession = new Session(sessionKey, SessionType, editor, station, line, customer); Dictionary<string, object> wfArguments = new Dictionary<string, object>(); wfArguments.Add("Key", sessionKey); wfArguments.Add("Station", station); wfArguments.Add("CurrentFlowSession", currentSession); wfArguments.Add("Editor", editor); wfArguments.Add("PdLine", line); wfArguments.Add("Customer", customer); wfArguments.Add("SessionType", SessionType); string wfName, rlName; RouteManagementUtils.GetWorkflow(station, "CombineCOAandDNBlock.xoml", "", out wfName, out rlName); WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow(wfName, rlName, wfArguments); currentSession.AddValue(Session.SessionKeys.CustSN, customerSN); currentSession.SetInstance(instance); if (!SessionManager.GetInstance.AddSession(currentSession)) { currentSession.WorkflowInstance.Terminate("Session:" + sessionKey + " Exists."); } currentSession.WorkflowInstance.Start(); currentSession.SetHostWaitOne(); if (currentSession.Exception != null) { if (currentSession.GetValue(Session.SessionKeys.WFTerminated) != null) { currentSession.ResumeWorkFlow(); } throw currentSession.Exception; } S_RowData_Product ret = new S_RowData_Product(); ret.DN = ""; ret.Model = ""; ret.ProductID = ""; ret.isBT = "false"; ret.isCDSI = ""; ret.isFactoryPo = ""; ret.isWin8 = ""; IProduct temp = productRepository.GetProductByCustomSn(customerSN); if (null != temp) { ret.ProductID = temp.ProId; ret.isBT = temp.IsBT.ToString(); ret.Model = temp.Model; IList<IMES.FisObject.Common.Model.ModelInfo> isPO = modelRep.GetModelInfoByModelAndName(temp.Model, "PO"); foreach (IMES.FisObject.Common.Model.ModelInfo tmpPO in isPO) { if (tmpPO.Value == "Y") { ret.isCDSI = "true"; } else { IList<IMES.FisObject.Common.Model.ModelInfo> isATSNAV = modelRep.GetModelInfoByModelAndName(temp.Model, "ATSNAV"); foreach (IMES.FisObject.Common.Model.ModelInfo tmpATSNAV in isATSNAV) { if (tmpATSNAV.Value == null) { } else if (tmpATSNAV.Value != "") { ret.isCDSI = "true"; } break; } } break; } if (ret.isCDSI == "true") { CdsiastInfo condition = new CdsiastInfo(); condition.snoId = temp.ProId; condition.tp = "FactoryPO"; IList<CdsiastInfo> isCdsiastInfo = productRepository.GetCdsiastInfoList(condition); ret.isFactoryPo = ""; foreach (CdsiastInfo tmpCdsiastInfo in isCdsiastInfo) { ret.isFactoryPo = tmpCdsiastInfo.sno; break; } if (ret.isBT == "true" || ret.isBT == "True") { } else { if (ret.isFactoryPo == "" || ret.isFactoryPo == null) { throw new FisException("CHK882", new string[] { }); } } } IList<MoBOMInfo> win8list = bomRepository.GetPnListByModelAndBomNodeTypeAndDescr(temp.Model, "P1", "ECOA"); if (win8list != null && win8list.Count > 0) { IList<string> typeList = new List<string>(); typeList.Add("P/N"); typeList.Add("Key"); typeList.Add("Hash"); IList<IMES.FisObject.FA.Product.ProductInfo> infoList = productRepository.GetProductInfoList(temp.ProId, typeList); if (infoList == null || infoList.Count != 3) { throw new FisException("CHK885", new string[] { }); //ret.isWin8 = "true"; } else { ret.isWin8 = "true"; } } if (ret.isCDSI == "true") { DNQueryCondition conditionDN = new DNQueryCondition(); DateTime aTime = DateTime.Now; aTime = aTime.AddDays(-3); conditionDN.ShipDateFrom = new DateTime(aTime.Year, aTime.Month, aTime.Day, 0, 0, 0, 0); conditionDN.Model = ret.Model; if (conditionDN.Model != "") { IList<Srd4CoaAndDn> dnList = currentRepository.GetDNListByConditionForPerformanceWithSorting(conditionDN); foreach (Srd4CoaAndDn tmp in dnList) { if (ret.isFactoryPo != "") { if (ret.isFactoryPo != tmp.PoNo) { continue; } } ret.DN = tmp.DeliveryNO; break; } } } else { Delivery assignDelivery = null; int assignQty = 0; IList<Delivery> deliveryList = currentRepository.GetDeliveryListByModel(ret.Model,"PC",12,"00"); if (deliveryList.Count == 0) { if (temp.IsBT) { } else { List<string> errpara = new List<string>(); errpara.Add(customerSN); throw new FisException("PAK101", errpara);//无此机型Delivery! } } //a) ShipDate 越早,越优先 //b) 散装优先于非散装 //c) 剩余未包装Product数量越少的越优先 bool assignNA = false; foreach (Delivery dvNode in deliveryList) { int curqty = productRepository.GetCombinedQtyByDN(dvNode.DeliveryNo); int tmpqty = dvNode.Qty - curqty; int curQty = productRepository.GetCombinedQtyByDN(dvNode.DeliveryNo); if (tmpqty > 0 ) { bool naflag = false; foreach (DeliveryPallet dpNode in dvNode.DnPalletList) { if (dpNode.PalletID.Substring(0, 2) == "NA") { naflag = true; break; } } if (assignDelivery == null) { assignDelivery = dvNode; assignQty = tmpqty; assignNA = naflag; continue; } if (DateTime.Compare(assignDelivery.ShipDate, dvNode.ShipDate) < 0) { continue; } if (!assignNA && naflag) { assignDelivery = dvNode; assignQty = tmpqty; assignNA = naflag; } else if (assignNA == naflag) { if (tmpqty < assignQty) { assignDelivery = dvNode; assignQty = tmpqty; assignNA = naflag; } } } } if (assignDelivery == null) { if (temp.IsBT) { } else { FisException fe = new FisException("PAK103", new string[] { }); //没找到可分配的delivery throw fe; } } else { ret.DN = assignDelivery.DeliveryNo; } } } return ret; } catch (FisException e) { logger.Error(e.mErrmsg); throw e; } catch (Exception e) { logger.Error(e.Message); throw e; } finally { Session sessionDelete = SessionManager.GetInstance.GetSession(keyStr, SessionType); ; if (sessionDelete != null) { SessionManager.GetInstance.RemoveSession(sessionDelete); } logger.Debug("(_CombineCOAandDN)GetProduct end, customerSN:" + customerSN); } }
private void btnQueryData_ServerClick(object sender, System.EventArgs e) { try { string dn = txtDN.Text.Trim(); string pn = txtPO.Text.Trim(); string model = txtModel.Text.Trim(); string from = hidDateFrom.Value; string to = hidDateTo.Value; string dninfo = txtDNInfo.Text.Trim(); if ((dninfo == null || dninfo == "") && (dn == null || dn == "") && (pn == null || pn == "") && (model == null || model == "") && (from == null || from == "") && (to == null || to == "")) { jsAlert(GetLocalResourceObject(Pre + "_msgNoInput").ToString()); SetFocus(txtDN.ClientID); return; } if ((from == null || from == "") && (to != null && to != "")) { from = to; } if ((from != null && from != "") && (to == null || to == "")) { to = from; } DNQueryCondition cond = new DNQueryCondition(); cond.DNInfoValue = dninfo; cond.DeliveryNo = dn.ToUpper(); cond.PONo = pn.ToUpper(); cond.Model = model.ToUpper(); if ((from != null && from != "") && (to != null && to != "")) { DateTime t1 = Convert.ToDateTime(from);// new DateTime(int.Parse(from.Substring(0, 4)), int.Parse(from.Substring(5, 2)), int.Parse(from.Substring(8, 2))); DateTime t2 = Convert.ToDateTime(to);// new DateTime(int.Parse(to.Substring(0, 4)), int.Parse(to.Substring(5, 2)), int.Parse(to.Substring(8, 2))); if (t1 > t2) { jsAlert(GetLocalResourceObject(Pre + "_msgBadDate").ToString()); clickDateFrom(); return; } cond.ShipDateFrom = t1; cond.ShipDateTo = t2; } clearGrid(); int recordCount = 0; IList<DNForUI> dnList = iPoData.QueryData(opType, cond, out recordCount); if (dnList.Count == 0) { jsAlert(GetLocalResourceObject(Pre + "_msgNoRecord").ToString()); return; } if (recordCount > 1000) { jsAlert(GetLocalResourceObject(Pre + "_msgTooManyRecords").ToString()); } showTableData(dnList); } catch (FisException ee) { clearGrid(); writeToAlertMessage(ee.mErrmsg); } catch (Exception ex) { writeToAlertMessage(ex.Message); } finally { endWaitingCoverDiv(); } }
public IList<DNForUI> getDNList(DNQueryCondition MyCondition) { //2010-05-23 207006 ITC-1155-0099 logger.Debug("getDNList start, DeliveryNo:" + MyCondition.DeliveryNo + " , Model:" + MyCondition.Model + " , PONo:" + MyCondition.PONo + " , ShipDateFrom:" + MyCondition.ShipDateFrom + " , ShipDateTo:" + MyCondition.ShipDateTo); try { IList<DNForUI> result = currentDNRepository.GetDNListByCondition(MyCondition); if (result != null && result.Count > 600) { FisException fe = new FisException("CHK110", new string[] { }); throw fe; } return result; } catch (FisException e) { logger.Error(e.mErrmsg, e); throw e; } catch (Exception e) { logger.Error(e.Message, e); throw new SystemException(e.Message); } finally { logger.Debug("getDNList end, DeliveryNo:" + MyCondition.DeliveryNo + " , Model:" + MyCondition.Model + " , PONo:" + MyCondition.PONo + " , ShipDateFrom:" + MyCondition.ShipDateFrom + " , ShipDateTo:" + MyCondition.ShipDateTo); } }
private void btnQueryData_ServerClick(object sender, System.EventArgs e) { try { /* * Answer to: ITC-1360-1137 * Description: Clear grid before query. */ clearGrid(); string ship = txtShipment.Text.Trim(); string dn = txtDN.Text.Trim(); string pn = txtPO.Text.Trim(); string model = txtModel.Text.Trim(); string from = hidDateFrom.Value; string to = hidDateTo.Value; if ((ship == null || ship == "") && (dn == null || dn == "") && (pn == null || pn == "") && (model == null || model == "") && (from == null || from == "") && (to == null || to == "")) { jsAlert(GetLocalResourceObject(Pre + "_msgNoInput").ToString()); SetFocus(txtShipment.ClientID); return; } if ((from == null || from == "") && (to != null && to != "")) { from = to; } if ((from != null && from != "") && (to == null || to == "")) { to = from; } DNQueryCondition cond = new DNQueryCondition(); cond.ShipmentNo = ship.ToUpper(); cond.DeliveryNo = dn.ToUpper(); cond.PONo = pn.ToUpper(); cond.Model = model.ToUpper(); if ((from != null && from != "") && (to != null && to != "")) { DateTime t1 = Convert.ToDateTime(from);// new DateTime(int.Parse(from.Substring(0, 4)), int.Parse(from.Substring(5, 2)), int.Parse(from.Substring(8, 2))); DateTime t2 = Convert.ToDateTime(to);// new DateTime(int.Parse(to.Substring(0, 4)), int.Parse(to.Substring(5, 2)), int.Parse(to.Substring(8, 2))); if (t1 > t2) { jsAlert(GetLocalResourceObject(Pre + "_msgBadDate").ToString()); clickDateFrom(); return; } cond.ShipDateFrom = t1; cond.ShipDateTo = t2; } int recordCount = 0; IList<DNForUI> dnList = iPoData.QueryData("PL", cond, out recordCount); if (dnList.Count == 0) { jsAlert(GetLocalResourceObject(Pre + "_msgNoRecord").ToString()); return; } if (recordCount > 1000) { jsAlert(GetLocalResourceObject(Pre + "_msgTooManyRecords").ToString()); } DataTable dt = initTable1(); DataRow newRow; int cnt = 0; if (dnList != null) { foreach (DNForUI ele in dnList) { newRow = dt.NewRow(); newRow["DN"] += ele.DeliveryNo; newRow["ShipNo"] += ele.ShipmentID; newRow["PoNo"] += ele.PoNo; newRow["Model"] += ele.ModelName; newRow["ShipDate"] += ele.ShipDate.ToString("yyyy-MM-dd"); newRow["Qty"] += ele.Qty.ToString(); newRow["Status"] += ele.Status; newRow["CDate"] += ele.Cdt.ToString("yyyy-MM-dd"); dt.Rows.Add(newRow); cnt++; } } for (; cnt < initRowsCount; cnt++) { newRow = dt.NewRow(); dt.Rows.Add(newRow); } this.gve1.DataSource = dt; this.gve1.DataBind(); initTableColumnHeader1(); up1.Update(); } catch (FisException ee) { clearGrid(); writeToAlertMessage(ee.mErrmsg); } catch (Exception ex) { writeToAlertMessage(ex.Message); } finally { /* * Answer to: ITC-1360-1343 * Description: Set focus after query. */ txtShipment.Focus(); endWaitingCoverDiv(); } }
/// <summary> /// 获取Product表相关信息 /// </summary> /// <param name="line">line</param> /// <param name="editor">editor</param> /// <param name="station">station</param> /// <param name="customer">customer</param> /// <param name="customerSN">customer SN</param> public S_RowData_Product GetProduct(string line, string editor, string station, string customer,string customerSN) { logger.Debug("(_CombineCOAandDN)GetProduct start.customerSN:" + customerSN); string keyStr = ""; try { var currentProduct = CommonImpl.GetProductByInput(customerSN, CommonImpl.InputTypeEnum.CustSN); if (null == currentProduct) { List<string> errpara = new List<string>(); errpara.Add(customerSN); throw new FisException("SFC002", errpara); } if (!string.IsNullOrEmpty(currentProduct.CartonSN)) { string temp = "CartonSN:" + currentProduct.CartonSN.ToString(); List<string> errpara = new List<string>(); errpara.Add(temp); throw new FisException("CHK858", errpara); } if (!string.IsNullOrEmpty(currentProduct.DeliveryNo)) { string temp = "DeliveryNo:" + currentProduct.DeliveryNo.ToString(); List<string> errpara = new List<string>(); errpara.Add(temp); throw new FisException("CHK858", errpara); } if (!string.IsNullOrEmpty(currentProduct.PalletNo)) { string temp = "PalletNo:" + currentProduct.PalletNo.ToString(); List<string> errpara = new List<string>(); errpara.Add(temp); throw new FisException("CHK858", errpara); } if (!string.IsNullOrEmpty(currentProduct.PizzaID)) { string temp = "PizzaID:" + currentProduct.PizzaID.ToString(); List<string> errpara = new List<string>(); errpara.Add(temp); throw new FisException("CHK858", errpara); } if ( currentProduct.CartonWeight == (decimal)0.00) { } else { string temp = "CartonWeight:" + currentProduct.CartonWeight.ToString(); List<string> errpara = new List<string>(); errpara.Add(temp); throw new FisException("CHK858", errpara); } } catch (FisException e) { logger.Error(e.mErrmsg); throw e; } catch (Exception e) { logger.Error(e.Message); throw e; } try { string sessionKey = customerSN; keyStr = sessionKey; Session currentSession = new Session(sessionKey, SessionType, editor, station, line, customer); Dictionary<string, object> wfArguments = new Dictionary<string, object>(); wfArguments.Add("Key", sessionKey); wfArguments.Add("Station", station); wfArguments.Add("CurrentFlowSession", currentSession); wfArguments.Add("Editor", editor); wfArguments.Add("PdLine", line); wfArguments.Add("Customer", customer); wfArguments.Add("SessionType", SessionType); string wfName, rlName; RouteManagementUtils.GetWorkflow(station, "CombineCOAandDNBlock.xoml", "", out wfName, out rlName); WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow(wfName, rlName, wfArguments); currentSession.AddValue(Session.SessionKeys.CustSN, customerSN); currentSession.SetInstance(instance); if (!SessionManager.GetInstance.AddSession(currentSession)) { currentSession.WorkflowInstance.Terminate("Session:" + sessionKey + " Exists."); } currentSession.WorkflowInstance.Start(); currentSession.SetHostWaitOne(); if (currentSession.Exception != null) { if (currentSession.GetValue(Session.SessionKeys.WFTerminated) != null) { currentSession.ResumeWorkFlow(); } throw currentSession.Exception; } string isBSaM = currentSession.GetValue(ExtendSession.SessionKeys.IsBSamModel) as string; S_RowData_Product ret = new S_RowData_Product(); ret.DN = ""; ret.Model = ""; ret.isBSaM = ""; ret.ProductID = ""; ret.isBT = "false"; ret.isCDSI = ""; ret.isFactoryPo = ""; ret.isWin8 = ""; IProduct temp = productRepository.GetProductByCustomSn(customerSN); if (null != temp) { ret.ProductID = temp.ProId; ret.isBT = temp.IsBT.ToString(); ret.Model = temp.Model; IList<IMES.FisObject.Common.Model.ModelInfo> isPO = modelRep.GetModelInfoByModelAndName(temp.Model, "PO"); foreach (IMES.FisObject.Common.Model.ModelInfo tmpPO in isPO) { if (tmpPO.Value == "Y") { ret.isCDSI = "true"; } else { IList<IMES.FisObject.Common.Model.ModelInfo> isATSNAV = modelRep.GetModelInfoByModelAndName(temp.Model, "ATSNAV"); foreach (IMES.FisObject.Common.Model.ModelInfo tmpATSNAV in isATSNAV) { if (tmpATSNAV.Value == null) { } else if (tmpATSNAV.Value != "") { ret.isCDSI = "true"; } break; } } break; } if (ret.isCDSI == "true") { CdsiastInfo condition = new CdsiastInfo(); condition.snoId = temp.ProId; condition.tp = "FactoryPO"; IList<CdsiastInfo> isCdsiastInfo = productRepository.GetCdsiastInfoList(condition); ret.isFactoryPo = ""; foreach (CdsiastInfo tmpCdsiastInfo in isCdsiastInfo) { ret.isFactoryPo = tmpCdsiastInfo.sno; break; } if (ret.isBT == "true" || ret.isBT == "True") { } else { if (ret.isFactoryPo == "" || ret.isFactoryPo == null) { throw new FisException("CHK882", new string[] { }); } } } //Vincent 2015-02-26 Mo 綁訂PoNo else if (temp.IsBindedPo) { ret.isCDSI = "true"; ret.isFactoryPo = temp.BindPoNo; } //Marked by Benson at 20130517 For CQ Mantis 24 // IList<MoBOMInfo> win8list = bomRepository.GetPnListByModelAndBomNodeTypeAndDescr(temp.Model, "P1", "ECOA"); // if (win8list != null && win8list.Count > 0) //Marked by Benson at 20130517 For CQ Mantis 24 bool bWIN8 = false; CommonImpl2 cm2 = new CommonImpl2(); IHierarchicalBOM bom = bomRepository.GetHierarchicalBOMByModel(temp.Model); bWIN8=cm2.CheckIsWIN8(bom); if(bWIN8) { // mantis 1574 IList<string> valueList = ipartRepository.GetValueFromSysSettingByName("Site"); if (valueList.Count == 0) { throw new Exception("Error:尚未設定Site..."); } string errMsg = ""; IList<string> typeList = new List<string>(); typeList.Add("P/N"); typeList.Add("Key"); if (valueList[0] == "ICC") { typeList.Add("COA"); } else { typeList.Add("Hash"); } IList<IMES.FisObject.FA.Product.ProductInfo> infoList = productRepository.GetProductInfoList(temp.ProId, typeList); if (infoList != null) { StringBuilder infoTypes = new StringBuilder(); foreach (var v in infoList) { if ((null != v.InfoValue) && !string.IsNullOrEmpty(v.InfoValue.Trim())) infoTypes.Append(v.InfoType).Append(","); } string win8Type = infoTypes.ToString(); foreach (string s in typeList) { if (!(win8Type.Contains(s))) errMsg += s+ "缺少 "; } } else { foreach (string s in typeList) errMsg += s + "缺少 "; } if (!string.IsNullOrEmpty(errMsg)) { throw new FisException("CHK969", new string[] { errMsg }); } ret.isWin8 = "true"; } if (!"Y".Equals(isBSaM)) { if (ret.isCDSI == "true") { DNQueryCondition conditionDN = new DNQueryCondition(); DateTime aTime = DateTime.Now; aTime = aTime.AddDays(-3); conditionDN.ShipDateFrom = new DateTime(aTime.Year, aTime.Month, aTime.Day, 0, 0, 0, 0); conditionDN.Model = ret.Model; if (conditionDN.Model != "") { IList<Srd4CoaAndDn> dnList = currentRepository.GetDNListByConditionForPerformanceWithSorting(conditionDN); foreach (Srd4CoaAndDn tmp in dnList) { if (ret.isFactoryPo != "") { if (ret.isFactoryPo != tmp.PoNo) { continue; } } ret.DN = tmp.DeliveryNO; break; } } } else { Delivery assignDelivery = null; int assignQty = 0; // modify for other model, ex: Jamestown in mantis 1945 //IList<Delivery> deliveryList = currentRepository.GetDeliveryListByModel(ret.Model,"PC",12,"00"); IList<Delivery> deliveryList = getDnByModel(ret.Model); //Vincent 2015-02-27 過濾綁訂PoDN IList<string> bindPoNoList = moRep.GetBindPoNoByModel(ret.Model); if (bindPoNoList != null && bindPoNoList.Count > 0) { deliveryList = deliveryList.Where(x => !bindPoNoList.Contains(x.PoNo)).ToList(); } if (deliveryList.Count == 0) { if (temp.IsBT) { } else { List<string> errpara = new List<string>(); errpara.Add(customerSN); throw new FisException("PAK101", errpara);//无此机型Delivery! } } //a) ShipDate 越早,越优先 //b) 散装优先于非散装 //c) 剩余未包装Product数量越少的越优先 bool assignNA = false; foreach (Delivery dvNode in deliveryList) { int curqty = productRepository.GetCombinedQtyByDN(dvNode.DeliveryNo); int tmpqty = dvNode.Qty - curqty; int curQty = productRepository.GetCombinedQtyByDN(dvNode.DeliveryNo); if (tmpqty > 0 ) { bool naflag = false; foreach (DeliveryPallet dpNode in dvNode.DnPalletList) { if (dpNode.PalletID.Substring(0, 2) == "NA") { naflag = true; break; } } if (assignDelivery == null) { assignDelivery = dvNode; assignQty = tmpqty; assignNA = naflag; continue; } if (DateTime.Compare(assignDelivery.ShipDate, dvNode.ShipDate) < 0) { continue; } if (!assignNA && naflag) { assignDelivery = dvNode; assignQty = tmpqty; assignNA = naflag; } else if (assignNA == naflag) { if (tmpqty < assignQty) { assignDelivery = dvNode; assignQty = tmpqty; assignNA = naflag; } } } } if (assignDelivery == null) { if (temp.IsBT) { } else { FisException fe = new FisException("PAK103", new string[] { }); //没找到可分配的delivery throw fe; } } else { ret.DN = assignDelivery.DeliveryNo; } } } else // isBSaM { //if (! ChkInDelivery(ret.Model)) //{ // List<string> errpara = new List<string>(); // errpara.Add(ret.Model); // throw new FisException("PAK174", errpara); //} if (ChkInCartonLoc(ret.ProductID)) { List<string> errpara = new List<string>(); errpara.Add(ret.ProductID); throw new FisException("PAK175", errpara); } ret.isBSaM = isBSaM; //Y } } return ret; } catch (FisException e) { logger.Error(e.mErrmsg); throw e; } catch (Exception e) { logger.Error(e.Message); throw e; } finally { Session sessionDelete = SessionManager.GetInstance.GetSession(keyStr, SessionType); ; if (sessionDelete != null) { SessionManager.GetInstance.RemoveSession(sessionDelete); } logger.Debug("(_CombineCOAandDN)GetProduct end, customerSN:" + customerSN); } }
/* /// <summary> /// 获取DN表相关信息 /// </summary> public IList<S_RowData_COAandDN> GetDNList() { logger.Debug("(_CombineCOAandDN)GetDNList start."); try { IList<S_RowData_COAandDN> ret = new List<S_RowData_COAandDN>(); DNQueryCondition condition = new DNQueryCondition(); DateTime temp = DateTime.Now; temp = temp.AddDays(-3); condition.ShipDateFrom = new DateTime(temp.Year, temp.Month, temp.Day, 0,0,0,0); IList<Srd4CoaAndDn> dnList = currentRepository.GetDNListByConditionForPerformance(condition); foreach (Srd4CoaAndDn tmp in dnList) { S_RowData_COAandDN ele = new S_RowData_COAandDN(); ele.DeliveryNO = tmp.DeliveryNO; ele.Model = tmp.Model; ele.CustomerPN = tmp.CustomerPN; ele.PoNo = tmp.PoNo; ele.Date = tmp.ShipDate.ToString("yyyy/MM/dd"); ele.Qty = tmp.Qty.ToString(); ele.PackedQty = tmp.PackedQty.ToString(); ret.Add(ele); } return ret; } catch (FisException e) { logger.Error(e.mErrmsg, e); throw new Exception(e.mErrmsg); } catch (Exception e) { logger.Error(e.Message, e); throw new SystemException(e.Message); } finally { logger.Debug("(_CombineCOAandDN)GetDNList end."); } }*/ /// <summary> /// 获取DN表相关信息 /// </summary> public IList<S_RowData_COAandDN> GetDNList() { logger.Debug("(_CombineCOAandDN)GetDNList start."); try { IList<S_RowData_COAandDN> ret = new List<S_RowData_COAandDN>(); DNQueryCondition condition = new DNQueryCondition(); DateTime temp = DateTime.Now; temp = temp.AddDays(-3); condition.ShipDateFrom = new DateTime(temp.Year, temp.Month, temp.Day, 0, 0, 0, 0); IList<DNForUI> dnList = currentRepository.GetDNListByCondition(condition); foreach (DNForUI tmp in dnList) { S_RowData_COAandDN ele = new S_RowData_COAandDN(); ele.DeliveryNO = tmp.DeliveryNo; if (tmp.Status != "00") { continue; } if (!( (tmp.ModelName.Length == 12 && tmp.ModelName.Substring(0, 2) == "PC") || CommonImpl.GetInstance().CheckModelByProcReg(tmp.ModelName, true) // modify for other model, ex: Jamestown in mantis 1945 )) { continue; } ele.Model = tmp.ModelName; ele.CustomerPN = currentRepository.GetDeliveryInfoValue(tmp.DeliveryNo, "PartNo"); ele.PoNo = tmp.PoNo; ele.Date = tmp.ShipDate.ToString("yyyy/MM/dd"); ele.Qty = tmp.Qty.ToString(); int qty = 0; int packedQty = 0; qty = tmp.Qty; IList<IProduct> productList = new List<IProduct>(); productList = productRepository.GetProductListByDeliveryNo(tmp.DeliveryNo); if (null != productList) { ele.PackedQty = productList.Count.ToString(); packedQty = productList.Count; } if (packedQty > qty) { continue; } ret.Add(ele); } return ret; } catch (FisException e) { logger.Error(e.mErrmsg, e); throw new Exception(e.mErrmsg); } catch (Exception e) { logger.Error(e.Message, e); throw new SystemException(e.Message); } finally { logger.Debug("(_CombineCOAandDN)GetDNList end."); } }
/// <summary> /// Delivery 分配原则 /// </summary> /// <param name="executionContext"></param> /// <returns></returns> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { IProductRepository productRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>(); IDeliveryRepository deliveryRep = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>(); List<string> errpara = new List<string>(); Product curProduct = (Product)CurrentSession.GetValue(Session.SessionKeys.Product); string custSN = (string)CurrentSession.GetValue(Session.SessionKeys.CustSN); string DN = (string)CurrentSession.GetValue(Session.SessionKeys.DeliveryNo); string DNTemp = DN; IList<string> productList = new List<string>(); productList.Add(curProduct.ProId); Delivery reDelivery = deliveryRep.Find(DN); if (reDelivery == null) { throw new FisException("CHK190", new string[] { DN });//DN不存在 } int qty = 0; int packedQty = 0; qty = reDelivery.Qty; IList<IProduct> getList = new List<IProduct>(); getList = productRep.GetProductListByDeliveryNo(DN); if (null != getList) { packedQty = getList.Count; } string dn1 = ""; string dn2 = ""; bool full = false; if (packedQty > qty || packedQty == qty) { string poNo = (string)CurrentSession.GetValue(Session.SessionKeys.Pno); if (null == poNo) { poNo = ""; } if (poNo != "") { full = true; DNQueryCondition condition = new DNQueryCondition(); DateTime temp = DateTime.Now; temp = temp.AddDays(-3); condition.Model = reDelivery.ModelName; condition.ShipDateFrom = new DateTime(temp.Year, temp.Month, temp.Day, 0, 0, 0, 0); IList<DNForUI> dnList = deliveryRep.GetDNListByConditionWithSorting(condition); foreach (DNForUI tmp in dnList) { if (tmp.Status != "00") { continue; } if (!(tmp.ModelName.Length == 12 && tmp.ModelName.Substring(0, 2) == "PC")) { continue; } int qtyTemp = 0; int packedQtyTemp = 0; qtyTemp = tmp.Qty; IList<IProduct> proList = new List<IProduct>(); proList = productRep.GetProductListByDeliveryNo(tmp.DeliveryNo); if (null != productList) { packedQtyTemp = proList.Count; } if (packedQtyTemp > qtyTemp || packedQtyTemp == qtyTemp) { continue; } if (poNo != "") { if (tmp.PoNo != poNo) { continue; } } if (dn1 == "") { dn1 = tmp.DeliveryNo; } else if (dn2 == "") { dn2 = tmp.DeliveryNo; } if (dn1 != "" && dn2 != "") { break; } } } else { full = true; Delivery assignDelivery = null; int assignQty = 0; IList<Delivery> deliveryList = deliveryRep.GetDeliveryListByModel(curProduct.Model, "PC", 12, "00"); if (deliveryList.Count == 0) { List<string> errp = new List<string>(); errp.Add(curProduct.CUSTSN); throw new FisException("PAK101", errpara);//无此机型Delivery! } //a) ShipDate 越早,越优先 //b) 散装优先于非散装 //c) 剩余未包装Product数量越少的越优先 bool assignNA = false; foreach (Delivery dvNode in deliveryList) { int curqty = productRep.GetCombinedQtyByDN(dvNode.DeliveryNo); int tmpqty = dvNode.Qty - curqty; int curQty = productRep.GetCombinedQtyByDN(dvNode.DeliveryNo); if (tmpqty > 0) { bool naflag = false; foreach (DeliveryPallet dpNode in dvNode.DnPalletList) { if (dpNode.PalletID.Substring(0, 2) == "NA") { naflag = true; break; } } if (assignDelivery == null) { assignDelivery = dvNode; assignQty = tmpqty; assignNA = naflag; continue; } if (DateTime.Compare(assignDelivery.ShipDate, dvNode.ShipDate) < 0) { continue; } if (!assignNA && naflag) { assignDelivery = dvNode; assignQty = tmpqty; assignNA = naflag; } else if (assignNA == naflag) { if (tmpqty < assignQty) { assignDelivery = dvNode; assignQty = tmpqty; assignNA = naflag; } } } } if (assignDelivery == null) { FisException fe = new FisException("PAK103", new string[] { }); //没找到可分配的delivery throw fe; } dn1 = assignDelivery.DeliveryNo; assignDelivery = null; assignNA = false; assignQty = 0; foreach (Delivery dvNode in deliveryList) { if (dvNode.DeliveryNo == dn1) { continue; } int curqty = productRep.GetCombinedQtyByDN(dvNode.DeliveryNo); int tmpqty = dvNode.Qty - curqty; int curQty = productRep.GetCombinedQtyByDN(dvNode.DeliveryNo); if (tmpqty > 0) { bool naflag = false; foreach (DeliveryPallet dpNode in dvNode.DnPalletList) { if (dpNode.PalletID.Substring(0, 2) == "NA") { naflag = true; break; } } if (assignDelivery == null) { assignDelivery = dvNode; assignQty = tmpqty; assignNA = naflag; continue; } if (DateTime.Compare(assignDelivery.ShipDate, dvNode.ShipDate) < 0) { continue; } if (!assignNA && naflag) { assignDelivery = dvNode; assignQty = tmpqty; assignNA = naflag; } else if (assignNA == naflag) { if (tmpqty < assignQty) { assignDelivery = dvNode; assignQty = tmpqty; assignNA = naflag; } } } } if (assignDelivery != null) { dn2 = assignDelivery.DeliveryNo; } } } if (full == true) { if (dn1 != "") { logger.Debug("(INdn1)" + dn1); reDelivery = deliveryRep.Find(dn1); DN = dn1; productRep.BindDN(DN, productList, reDelivery.Qty); CurrentSession.AddValue(Session.SessionKeys.DeliveryNo, DN); CurrentSession.AddValue(Session.SessionKeys.Delivery, reDelivery); } var currentProduct = productRep.GetProductByCustomSn(custSN); if (currentProduct.DeliveryNo != DN) { if (dn2 != "") { logger.Debug("(INdn2)" + dn2); reDelivery = deliveryRep.Find(dn2); DN = dn2; productRep.BindDN(DN, productList, reDelivery.Qty); CurrentSession.AddValue(Session.SessionKeys.DeliveryNo, DN); CurrentSession.AddValue(Session.SessionKeys.Delivery, reDelivery); } } } else { logger.Debug("(NoFull)" + DN ); productRep.BindDN(DN, productList, reDelivery.Qty); CurrentSession.AddValue(Session.SessionKeys.DeliveryNo, DN); CurrentSession.AddValue(Session.SessionKeys.Delivery, reDelivery); } var currentProduct2 = productRep.GetProductByCustomSn(custSN); logger.Debug("(DNProduct)" + currentProduct2.DeliveryNo + "$"); if (currentProduct2.DeliveryNo.Trim() != DN.Trim()) { if (DNTemp != DN) { DNTemp = DNTemp + "&" + DN; } List<string> err = new List<string>(); err.Add(DNTemp); err.Add(custSN); throw new FisException("CHK188", err); } CurrentSession.AddValue(Session.SessionKeys.DeliveryNo, DN); CurrentSession.AddValue(Session.SessionKeys.Delivery, reDelivery); CurrentSession.AddValue("doDelivery", "true"); IList<IProduct> reIList = productRep.GetProductListByDeliveryNo(DN); if (reIList.Count == reDelivery.Qty) { reDelivery.Status = "87"; } if (reDelivery.Status == "87") { CurrentSession.AddValue(Session.SessionKeys.IsBT, false); } else { CurrentSession.AddValue(Session.SessionKeys.IsBT, true); } return base.DoExecute(executionContext); }
/// <summary> /// 根据查询条件获取符合条件的Delivery列表 /// </summary> /// <param name="MyCondition"></param> /// <returns></returns> IList<DNForUI> IPOData.getDNList(DNQueryCondition MyCondition) { logger.Debug("getDNList start, DeliveryNo:" + MyCondition.DeliveryNo + " , Model:" + MyCondition.Model + " , PONo:" + MyCondition.PONo + " , ShipDateFrom:" + MyCondition.ShipDateFrom + " , ShipDateTo:" + MyCondition.ShipDateTo); try { int totalLength =601; IList<DNForUI> result = currentDNRepository.GetDNListByCondition(MyCondition, out totalLength); if (result != null && result.Count > 600) { FisException fe = new FisException("CHK110", new string[] {}); throw fe; } return result; } catch (FisException e) { logger.Error(e.mErrmsg, e); throw e; } catch (Exception e) { logger.Error(e.Message, e); throw new SystemException(e.Message); } finally { logger.Debug("getDNList end, DeliveryNo:" + MyCondition.DeliveryNo + " , Model:" + MyCondition.Model + " , PONo:" + MyCondition.PONo + " , ShipDateFrom:" + MyCondition.ShipDateFrom + " , ShipDateTo:" + MyCondition.ShipDateTo); } }
protected void btnButton1_ServerClick(object sender, EventArgs e) { string strDNNO = hidDN.Value; try { DNQueryCondition condition = new DNQueryCondition(); condition.DeliveryNo = strDNNO; S_RowData_ShipDate dn = currentBll.GetDN(strDNNO); if (dn.dn == null || dn.dn == "") { ReReset(); return; } ReStatus(dn.Status); ReShipDate(dn.ShipDate); ReQty(dn.Qty); /*if (dn.Status.Equals("98")) { writeToAlertMessage(this.GetLocalResourceObject(Pre + "_msgInvalidStatus").ToString()); HIfUpdate.Value = "doNotSave"; }*/ } catch (FisException ex) { writeToAlertMessage(ex.mErrmsg); } catch (Exception ex) { writeToAlertMessage(ex.Message); } }