Esempio n. 1
0
        public void SetRelatedRanker(List <AscmGenerateTaskRule> list)
        {
            if (list != null && list.Count > 0)
            {
                string ids = string.Empty;
                foreach (AscmGenerateTaskRule ascmGenerateTaskRule in list)
                {
                    if (!string.IsNullOrEmpty(ids) && !string.IsNullOrEmpty(ascmGenerateTaskRule.relatedRanker))
                    {
                        ids += ",";
                    }
                    if (!string.IsNullOrEmpty(ascmGenerateTaskRule.relatedRanker))
                    {
                        ids += ascmGenerateTaskRule.relatedRanker;
                    }
                }

                string where = AscmCommonHelperService.GetInstance().IsJudgeListCount(ids, "userId");
                if (!string.IsNullOrEmpty(where))
                {
                    string sql = "from AscmUserInfo where " + where;
                    IList <AscmUserInfo> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmUserInfo>(sql);
                    if (ilist != null && ilist.Count > 0)
                    {
                        List <AscmUserInfo> listAscmUserInfo = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmUserInfo>(ilist);
                        foreach (AscmGenerateTaskRule ascmGenerateTaskRule in list)
                        {
                            if (!string.IsNullOrEmpty(ascmGenerateTaskRule.relatedRanker))
                            {
                                ascmGenerateTaskRule.ascmUserInfo = listAscmUserInfo.Find(e => e.userId == ascmGenerateTaskRule.relatedRanker);
                            }
                        }
                    }
                }
            }
        }
Esempio n. 2
0
 public void Delete(List <AscmContainerSpec> listAscmContainerSpec)
 {
     try
     {
         using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
         {
             try
             {
                 YnDaoHelper.GetInstance().nHibernateHelper.DeleteList(listAscmContainerSpec);
                 tx.Commit();//正确执行提交
             }
             catch (Exception ex)
             {
                 tx.Rollback();//回滚
                 throw ex;
             }
         }
     }
     catch (Exception ex)
     {
         YnBaseClass2.Helper.LogHelper.GetLog().Error("删除失败(Delete AscmContainerSpec)", ex);
         throw ex;
     }
 }
Esempio n. 3
0
        /// <summary>
        /// 流转信息查询
        /// 2013/07/16
        /// </summary>
        /// <param name="ynPage"></param>
        /// <param name="sortName"></param>
        /// <param name="sortOrder"></param>
        /// <param name="queryWord"></param>
        /// <returns></returns>
        public List <AscmTagLog> GetFlowInfo(YnPage ynPage, string sortName, string sortOrder, string queryWord)
        {
            List <AscmTagLog> list = null;

            try
            {
                string sort = " order by createTime desc";
                //if (!string.IsNullOrEmpty(sortName))
                //{
                //    sort = " order by " + sortName.Trim() + " ";
                //    if (!string.IsNullOrEmpty(sortOrder))
                //        sort += sortOrder.Trim();
                //}
                string strHql = "from AscmTagLog a where a.readTime=(select max(readTime) from AscmTagLog where epcId=a.epcId)";
                // string where = "";
                //where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where,queryWord);
                if (!string.IsNullOrEmpty(queryWord))
                {
                    strHql += " and " + queryWord;
                }
                IList <AscmTagLog> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmTagLog>(strHql + sort, strHql, ynPage);
                if (ilist != null && ilist.Count > 0)
                {
                    list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmTagLog>(ilist);
                    SetObjectId(list);        //设置物件的ID
                    SetSupplier(list);        //设置物件的供应商
                    SetAscmReadingHead(list); //设置地址
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmTagLog)", ex);
                throw ex;
            }
            return(list);
        }
Esempio n. 4
0
        /// <summary>
        /// 导出Excell用
        /// </summary>
        /// <param name="queryWord"></param>
        /// <param name="whereOther"></param>
        /// <returns></returns>
        public List <AscmContainer> GetList(string queryWord, string whereOther)
        {
            List <AscmContainer> list = null;

            try
            {
                string sql = "from AscmContainer ";

                string where = "", whereQueryWord = "";
                if (!string.IsNullOrEmpty(queryWord))
                {
                    whereQueryWord = " (sn like '%" + queryWord.Trim() + "%')";
                }
                where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);
                where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereOther);

                if (!string.IsNullOrEmpty(where))
                {
                    sql += " where " + where;
                }
                IList <AscmContainer> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmContainer>(sql);
                if (ilist != null)
                {
                    list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmContainer>(ilist);
                    SetSupplier(list);
                    SetSpec(list);
                    SetAscmReadingHead(list);//设置地址
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmContainer)", ex);
                throw ex;
            }
            return(list);
        }
Esempio n. 5
0
 public void Update(List <AscmReadingHead> list)
 {
     try
     {
         using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
         {
             try
             {
                 YnDaoHelper.GetInstance().nHibernateHelper.UpdateList(list);
                 tx.Commit();
             }
             catch (Exception ex)
             {
                 tx.Rollback();
                 throw ex;
             }
         }
     }
     catch (Exception ex)
     {
         YnBaseClass2.Helper.LogHelper.GetLog().Error("保存失败(Update AscmReadingHead)", ex);
         throw ex;
     }
 }
Esempio n. 6
0
 public void Save(AscmMesInteractiveLog ascmMesInteractiveLog)
 {
     try
     {
         using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
         {
             try
             {
                 YnDaoHelper.GetInstance().nHibernateHelper.Save(ascmMesInteractiveLog);
                 tx.Commit();//正确执行提交
             }
             catch (Exception ex)
             {
                 tx.Rollback();//回滚
                 throw ex;
             }
         }
     }
     catch (Exception ex)
     {
         YnBaseClass2.Helper.LogHelper.GetLog().Error("保存失败(Save AscmMesInteractiveLog)", ex);
         throw ex;
     }
 }
 public void Save(List <AscmWmsContainerDelivery> listAscmWmsContainerDelivery)
 {
     try
     {
         using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
         {
             try
             {
                 YnDaoHelper.GetInstance().nHibernateHelper.SaveList(listAscmWmsContainerDelivery);
                 tx.Commit();//正确执行提交
             }
             catch (Exception ex)
             {
                 tx.Rollback();//回滚
                 throw ex;
             }
         }
     }
     catch (Exception ex)
     {
         YnBaseClass2.Helper.LogHelper.GetLog().Error("保存失败(Save AscmWmsContainerDelivery)", ex);
         throw ex;
     }
 }
Esempio n. 8
0
        public AscmRfid Get(string id)
        {
            AscmRfid ascmRfid = null;

            try
            {
                ascmRfid = YnDaoHelper.GetInstance().nHibernateHelper.Get <AscmRfid>(id);
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Get AscmRfid)", ex);
                throw ex;
            }
            if (ascmRfid == null)
            {
                return(ascmRfid);
            }
            else if (!string.IsNullOrEmpty(ascmRfid.bindType))
            {
                ascmRfid.bindType = ascmRfid.bindType.ToUpper();
            }

            return(ascmRfid);
        }
        public List <AscmLocationMaterialLink> GetListByWarelocationIds(string warelocationIds)
        {
            if (string.IsNullOrEmpty(warelocationIds))
            {
                return(null);
            }

            List <AscmLocationMaterialLink> list = new List <AscmLocationMaterialLink>();
            var    ieWarelocationId = warelocationIds.Split(',').Distinct();
            int    count            = ieWarelocationId.Count();
            string _warelocationIds = string.Empty;

            for (int i = 0; i < count; i++)
            {
                if (!string.IsNullOrEmpty(_warelocationIds))
                {
                    _warelocationIds += ",";
                }
                _warelocationIds += ieWarelocationId.ElementAt(i);
                if ((i + 1) % 500 == 0 || (i + 1) == count)
                {
                    if (!string.IsNullOrEmpty(_warelocationIds))
                    {
                        string hql = "from AscmLocationMaterialLink where pk.warelocationId in(" + _warelocationIds + ")";
                        IList <AscmLocationMaterialLink> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmLocationMaterialLink>(hql);
                        if (ilist != null)
                        {
                            list.AddRange(ilist);
                        }
                    }
                    _warelocationIds = string.Empty;
                }
            }

            return(list);
        }
        public AscmWmsContainerDelivery GetCurrent(string containerSn, string sessionKey)
        {
            try
            {
                string sort = " order by id desc ";
                string sql  = "from AscmWmsContainerDelivery where containerSn='" + containerSn + "' and (status is null or status='') and createTime>='" + DateTime.Now.AddDays(-2).ToString("yyyy-MM-dd 00:00:00") + "'";

                YnPage ynPage = new YnPage();
                ynPage.SetPageSize(1);
                ynPage.SetCurrentPage(1);
                IList <AscmWmsContainerDelivery> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmWmsContainerDelivery>(sql + sort, sql, ynPage, sessionKey);
                //IList<AscmContainerDelivery> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find<AscmContainerDelivery>(sql, sessionKey);
                if (ilist != null && ilist.Count > 0)
                {
                    return(ilist[0]);
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmWmsContainerDelivery)", ex);
                throw ex;
            }
            return(null);
        }
 public void Update(List <AscmDeliveryNotifyMain> listAscmDeliveryNotifyMain)
 {
     try
     {
         using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
         {
             try
             {
                 YnDaoHelper.GetInstance().nHibernateHelper.UpdateList(listAscmDeliveryNotifyMain);
                 tx.Commit();//正确执行提交
             }
             catch (Exception ex)
             {
                 tx.Rollback();//回滚
                 throw ex;
             }
         }
     }
     catch (Exception ex)
     {
         YnBaseClass2.Helper.LogHelper.GetLog().Error("更新失败(Update listAscmDeliveryNotifyMain)", ex);
         throw ex;
     }
 }
Esempio n. 12
0
        void setSiteCode(List <MideaAscm.Dal.SupplierPreparation.Entities.AscmContainer> list)
        {
            System.Text.StringBuilder sbSn = new System.Text.StringBuilder();
            sbSn.Clear();
            var q = list.Select(e => e.supplierId).Distinct();

            foreach (int supplierId in q)
            {
                if (sbSn.Length != 0)
                {
                    sbSn.Append(",");
                }
                sbSn.AppendFormat("{0}", supplierId);
            }
            if (string.IsNullOrEmpty(sbSn.ToString()))
            {
                return;
            }
            IList <MideaAscm.Dal.Base.Entities.AscmSupplierAddress> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <MideaAscm.Dal.Base.Entities.AscmSupplierAddress>("from AscmSupplierAddress where vendorId in (" + sbSn.ToString() + ")");
            List <MideaAscm.Dal.Base.Entities.AscmSupplierAddress>  listAscmReadingHead = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList(ilist);

            if (ilist.Count > 0)
            {
                foreach (Dal.SupplierPreparation.Entities.AscmContainer ascmTagLog in list)
                {
                    if (ascmTagLog.supplierId == 6128)
                    {
                        ascmTagLog._supplierName = "美的";
                    }
                    else
                    {
                        ascmTagLog._supplierName = listAscmReadingHead.Find(e => e.vendorId == ascmTagLog.supplierId).vendorSiteCode;
                    }
                }
            }
        }
Esempio n. 13
0
        /// <summary>设置需求备料单已领数量</summary>
        public void SetReceivedQuantity(List <AscmWmsPreparationDetail> list)
        {
            if (list == null && list.Count == 0)
            {
                return;
            }

            string where = string.Empty;
            var gb = list.GroupBy(P => P.wipEntityId);

            foreach (IGrouping <string, AscmWmsPreparationDetail> ig in gb)
            {
                string whereOther  = string.Empty;
                var    materialIds = ig.Select(P => P.materialId).Distinct();
                var    count       = materialIds.Count();
                string ids         = string.Empty;
                for (int i = 0; i < count; i++)
                {
                    if (!string.IsNullOrEmpty(ids))
                    {
                        ids += ",";
                    }
                    ids += materialIds.ElementAt(i);
                    if ((i + 1) % 500 == 0 || (i + 1) == count)
                    {
                        if (!string.IsNullOrEmpty(ids))
                        {
                            whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereOrAdd(whereOther, "materialId in(" + ids + ")");
                        }
                        ids = string.Empty;
                    }
                }
                where = YnBaseClass2.Helper.StringHelper.SqlWhereOrAdd(where, "wipEntityId='" + ig.Key + "' and (" + whereOther + ")");
            }

            if (string.IsNullOrEmpty(where))
            {
                return;
            }

            string hql = "select new AscmWmsLogisticsDetailLog(wipEntityId,materialId,sum(quantity)) from AscmWmsLogisticsDetailLog"
                         + " where " + where
                         + " group by wipEntityId,materialId";
            IList <AscmWmsLogisticsDetailLog> ilistLogisticsDetailLog = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmWmsLogisticsDetailLog>(hql);

            if (ilistLogisticsDetailLog == null || ilistLogisticsDetailLog.Count == 0)
            {
                return;
            }

            List <AscmWmsLogisticsDetailLog> listLogisticsDetailLog = ilistLogisticsDetailLog.ToList();

            foreach (AscmWmsPreparationDetail detail in list)
            {
                AscmWmsLogisticsDetailLog logisticsDetailLog = listLogisticsDetailLog.Find(P => P.wipEntityId == detail.wipEntityId && P.materialId == detail.materialId);
                if (logisticsDetailLog != null)
                {
                    detail.receivedQuantity = logisticsDetailLog.quantity;
                }
            }
        }
        public List <AscmDeliBatOrderLink> GetListByBatch(int batchId)
        {
            List <AscmDeliBatOrderLink> list = null;

            try
            {
                List <AscmDeliveryOrderDetail> listDeliOrderDetail = AscmDeliveryOrderDetailService.GetInstance().GetListByBatch(batchId);
                if (listDeliOrderDetail != null)
                {
                    string ids = "";
                    foreach (AscmDeliveryOrderDetail ascmDeliveryOrderDetail in listDeliOrderDetail)
                    {
                        if (ids != "")
                        {
                            ids += ",";
                        }
                        ids += ascmDeliveryOrderDetail.id;
                    }
                    if (!string.IsNullOrEmpty(ids))
                    {
                        string sql = "from AscmDeliBatOrderLink ";
                        string where = "";
                        where        = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, " id in(" + ids + ")");
                        if (!string.IsNullOrEmpty(where))
                        {
                            sql += " where " + where;
                        }
                        IList <AscmDeliBatOrderLink> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmDeliBatOrderLink>(sql);
                        if (ilist != null && ilist.Count > 0)
                        {
                            list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmDeliBatOrderLink>(ilist);
                            foreach (AscmDeliBatOrderLink deliBatOrderLink in list)
                            {
                                AscmDeliveryOrderDetail deliveryOrderDetail = listDeliOrderDetail.Find(P => P.id == deliBatOrderLink.id);
                                deliBatOrderLink.ascmDeliveryOrderDetail = deliveryOrderDetail;
                                deliBatOrderLink.batchId        = batchId;
                                deliBatOrderLink.batchBarCode   = deliveryOrderDetail.mainBatchBarCode;
                                deliBatOrderLink.batchDocNumber = deliveryOrderDetail.mainBatchDocNumber;
                                deliBatOrderLink.warehouseId    = deliveryOrderDetail.warehouseId;
                                deliBatOrderLink.mainId         = deliveryOrderDetail.mainId;
                            }
                        }
                        else
                        {
                            list = new List <AscmDeliBatOrderLink>();
                            foreach (AscmDeliveryOrderDetail deliveryOrderDetail in listDeliOrderDetail)
                            {
                                AscmDeliBatOrderLink ascmDeliBatOrderLink = new AscmDeliBatOrderLink();
                                ascmDeliBatOrderLink.id = deliveryOrderDetail.id;
                                ascmDeliBatOrderLink.ascmDeliveryOrderDetail = deliveryOrderDetail;
                                ascmDeliBatOrderLink.batchId          = batchId;
                                ascmDeliBatOrderLink.batchBarCode     = deliveryOrderDetail.mainBatchBarCode;
                                ascmDeliBatOrderLink.batchDocNumber   = deliveryOrderDetail.mainBatchDocNumber;
                                ascmDeliBatOrderLink.warehouseId      = deliveryOrderDetail.warehouseId;
                                ascmDeliBatOrderLink.mainId           = deliveryOrderDetail.mainId;
                                ascmDeliBatOrderLink.deliveryQuantity = deliveryOrderDetail.deliveryQuantity;
                                ascmDeliBatOrderLink.receivedQuantity = deliveryOrderDetail.deliveryQuantity;
                                list.Add(ascmDeliBatOrderLink);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmDeliBatOrderLink)", ex);
                throw ex;
            }
            return(list);
        }
Esempio n. 15
0
        public List <AscmCuxWipReleaseLines> GetList(int releaseHeaderId, string whereOther = "")
        {
            List <AscmCuxWipReleaseLines> list = null;

            try
            {
                string sort = " order by inventoryItemId ";
                //if (!string.IsNullOrEmpty(sortName))
                //{
                //    sort = " order by " + sortName.Trim() + " ";
                //    if (!string.IsNullOrEmpty(sortOrder))
                //        sort += sortOrder.Trim();
                //}
                AscmCuxWipReleaseHeaders ascmCuxWipReleaseHeaders = AscmCuxWipReleaseHeadersService.GetInstance().Get(releaseHeaderId);
                string sql = "from AscmCuxWipReleaseLines where releaseHeaderId=" + releaseHeaderId;

                string where = "", whereQueryWord = "";
                //if (!string.IsNullOrEmpty(queryWord))
                //    whereQueryWord = " (name like '%" + queryWord.Trim() + "%' or description like '%" + queryWord.Trim() + "%')";
                where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);
                where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereOther);

                if (!string.IsNullOrEmpty(where))
                {
                    sql += " and " + where;
                }
                //IList<AscmCuxWipReleaseLines> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find<AscmCuxWipReleaseLines>(sql + sort);
                IList <AscmCuxWipReleaseLines> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmCuxWipReleaseLines>(sql + sort);
                if (ilist != null)
                {
                    list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmCuxWipReleaseLines>(ilist);
                    SetMaterial(list);
                    SetWipRequirementOperations(list);
                    //计算未发数
                    foreach (AscmCuxWipReleaseLines ascmCuxWipReleaseLines in list)
                    {
                        ascmCuxWipReleaseLines.QUANTITY_AV = 0;
                        if (ascmCuxWipReleaseLines.ascmWipRequirementOperations != null)
                        {
                            if (ascmCuxWipReleaseHeaders.releaseType == "RETURN")
                            {
                                ascmCuxWipReleaseLines.QUANTITY_AV = ascmCuxWipReleaseLines.ascmWipRequirementOperations.quantityIssued;
                            }
                            else
                            {
                                int sign_REQUIRED_QUANTITY = 0;
                                if (ascmCuxWipReleaseLines.ascmWipRequirementOperations.requiredQuantity > 0)
                                {
                                    sign_REQUIRED_QUANTITY = 1;
                                }
                                else if (ascmCuxWipReleaseLines.ascmWipRequirementOperations.requiredQuantity < 0)
                                {
                                    sign_REQUIRED_QUANTITY = -1;
                                }
                                int sign_QUANTITY_ISSUED = 0;
                                if (ascmCuxWipReleaseLines.ascmWipRequirementOperations.quantityIssued > 0)
                                {
                                    sign_QUANTITY_ISSUED = 1;
                                }
                                else if (ascmCuxWipReleaseLines.ascmWipRequirementOperations.quantityIssued < 0)
                                {
                                    sign_QUANTITY_ISSUED = -1;
                                }
                                if (sign_REQUIRED_QUANTITY == sign_QUANTITY_ISSUED)
                                {
                                    ascmCuxWipReleaseLines.QUANTITY_AV = ascmCuxWipReleaseLines.ascmWipRequirementOperations.requiredQuantity - ascmCuxWipReleaseLines.ascmWipRequirementOperations.quantityIssued;
                                }
                                else if (Math.Abs(ascmCuxWipReleaseLines.ascmWipRequirementOperations.requiredQuantity) >= Math.Abs(ascmCuxWipReleaseLines.ascmWipRequirementOperations.quantityIssued))
                                {
                                    ascmCuxWipReleaseLines.QUANTITY_AV = ascmCuxWipReleaseLines.ascmWipRequirementOperations.requiredQuantity - ascmCuxWipReleaseLines.ascmWipRequirementOperations.quantityIssued;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmCuxWipReleaseLines)", ex);
                throw ex;
            }
            return(list);
        }
Esempio n. 16
0
 private void SetWipRequirementOperations(List <AscmCuxWipReleaseLines> list)
 {
     if (list != null && list.Count > 0)
     {
         string ids  = string.Empty;
         string ids1 = string.Empty;
         foreach (AscmCuxWipReleaseLines ascmCuxWipReleaseLines in list)
         {
             if (!string.IsNullOrEmpty(ids))
             {
                 ids += ",";
             }
             ids += "" + ascmCuxWipReleaseLines.inventoryItemId + "";
             if (!string.IsNullOrEmpty(ids1))
             {
                 ids1 += ",";
             }
             ids1 += "" + ascmCuxWipReleaseLines.wipEntityId + "";
         }
         string sql = "from AscmWipRequirementOperations where inventoryItemId in (" + ids + ") and wipEntityId in (" + ids1 + ")";
         IList <AscmWipRequirementOperations> ilistAscmWipRequirementOperations = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmWipRequirementOperations>(sql);
         if (ilistAscmWipRequirementOperations != null && ilistAscmWipRequirementOperations.Count > 0)
         {
             List <AscmWipRequirementOperations> listAscmWipRequirementOperations = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmWipRequirementOperations>(ilistAscmWipRequirementOperations);
             foreach (AscmCuxWipReleaseLines ascmCuxWipReleaseLines in list)
             {
                 ascmCuxWipReleaseLines.ascmWipRequirementOperations = listAscmWipRequirementOperations.Find(e => e.inventoryItemId == ascmCuxWipReleaseLines.inventoryItemId && e.wipEntityId == ascmCuxWipReleaseLines.wipEntityId);
             }
         }
     }
 }
        /// <summary>
        /// 提供中间件调用,建立领料员单次领料与领料单的关联
        /// </summary>
        /// <param name="forkliftRfid">叉车RFID</param>
        /// <param name="checkoutNo">当天第几次校验</param>
        /// <param name="checkTime">校验时间</param>
        /// <param name="sessionKey"></param>
        public void WmsStoreIssueCheck(string forkliftRfid, int checkoutNo, string checkTime, string sessionKey)
        {
            if (string.IsNullOrEmpty(forkliftRfid))
            {
                return;
            }
            if (checkoutNo <= 0)
            {
                return;
            }
            try
            {
                object obj = YnDaoHelper.GetInstance().nHibernateHelper.GetObject("select workerId from AscmForklift where tagId='" + forkliftRfid + "' and rownum=1", sessionKey);
                if (obj == null)
                {
                    return;
                }
                string workerId = obj.ToString();
                if (string.IsNullOrEmpty(workerId))
                {
                    return;
                }
                DateTime dt = DateTime.Now;
                DateTime.TryParse(checkTime, out dt);
                //获取领料员本次领料生成的领料单
                string hql = "from AscmWmsMtlRequisitionMain";
                string where = "";
                where        = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, "workerId='" + workerId + "'");
                where        = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, "checkout=0");
                where        = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, "createTime>='" + dt.ToString("yyyy-MM-dd 00:00") + "' and createTime<'" + dt.AddDays(1).ToString("yyyy-MM-dd 00:00") + "'");
                hql         += " where " + where;
                IList <AscmWmsMtlRequisitionMain> ilistRequisitionMain = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmWmsMtlRequisitionMain>(hql, sessionKey);
                if (ilistRequisitionMain == null || ilistRequisitionMain.Count == 0)
                {
                    return;
                }
                List <AscmWmsMtlRequisitionMain> listRequisitionMain = ilistRequisitionMain.ToList();

                ////避免硬件故障或中间件服务停止造成本次累计了前面未校验的领料单,此处作时间间隔限制
                //string maxCreateTime = listRequisitionMain.Max(P => P.createTime);
                //DateTime dtMaxCreateTime = DateTime.Now;
                //bool parseMaxCreateTime = DateTime.TryParse(maxCreateTime, out dtMaxCreateTime);

                foreach (AscmWmsMtlRequisitionMain requisitionMain in listRequisitionMain)
                {
                    ////凡比最晚生成的领料单早30分钟以上的将被排除
                    //DateTime dtCreateTime = DateTime.Now;
                    //if (parseMaxCreateTime && DateTime.TryParse(requisitionMain.createTime, out dtCreateTime) && dtMaxCreateTime.CompareTo(dtCreateTime.AddMinutes(30)) > 0)
                    //    continue;

                    requisitionMain.checkout   = true;
                    requisitionMain.checkOutNo = checkoutNo;
                    requisitionMain.checkTime  = dt.ToString("yyyy-MM-dd HH:mm");
                }

                using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession(sessionKey).BeginTransaction())
                {
                    try
                    {
                        YnDaoHelper.GetInstance().nHibernateHelper.UpdateList(listRequisitionMain, sessionKey);
                        tx.Commit();//正确执行提交
                    }
                    catch (Exception ex)
                    {
                        tx.Rollback();//回滚
                        throw ex;
                    }
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmWmsMtlRequisitionMain)", ex);
                throw ex;
            }
        }
Esempio n. 18
0
 /// <summary>
 /// 手持端盘点功能
 /// </summary>
 /// <param name="strSn"></param>
 public string  ContainerCheck(string strSn, string status, string userName)
 {
     //如果没有盘点任务开启
     if (YnDaoHelper.GetInstance().nHibernateHelper.GetCount("select count(*) from AscmCheck as ck where ck.count is null") == 0)
     {
         return("没有开启的盘点任务");
     }
     Dal.SupplierPreparation.Entities.AscmContainer ascmContainer = MideaAscm.Services.SupplierPreparation.AscmContainerService.GetInstance().Get(strSn);
     using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
     {
         try
         {
             if (!string.IsNullOrEmpty(status))
             {
                 //如果状态是丢失
                 if (status == "LOST")
                 {
                     ascmContainer.status = Dal.SupplierPreparation.Entities.AscmContainer.StatusDefine.losted;
                 }
                 else
                 {
                     ascmContainer.status = Dal.SupplierPreparation.Entities.AscmContainer.StatusDefine.unuse;
                 }
                 //盘点ID
                 int intcheckId = YnDaoHelper.GetInstance().nHibernateHelper.GetMaxId("select max(id) from AscmCheck)");
                 //如果没有重复就新建
                 if (YnDaoHelper.GetInstance().nHibernateHelper.GetCount("select count(*) from AscmCheckContainerInfo where containerId='" + strSn + "' and checkId=" + intcheckId + "") == 0)
                 {
                     Dal.ContainerManage.Entities.AscmCheckContainerInfo CheckInfo = new Dal.ContainerManage.Entities.AscmCheckContainerInfo();
                     CheckInfo.id          = YnDaoHelper.GetInstance().nHibernateHelper.GetMaxId("select max(id) from AscmCheckContainerInfo)") + 1;
                     CheckInfo.checkId     = intcheckId;
                     CheckInfo.containerId = ascmContainer.sn;
                     CheckInfo.status      = status;
                     CheckInfo.supplierId  = ascmContainer.supplierId;
                     CheckInfo.createTime  = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                     CheckInfo.createUser  = userName;
                     YnDaoHelper.GetInstance().nHibernateHelper.Save <Dal.ContainerManage.Entities.AscmCheckContainerInfo>(CheckInfo);
                 }
                 else    //重复就更新
                 {
                     Dal.ContainerManage.Entities.AscmCheckContainerInfo ascmCheckContainerInfo = YnDaoHelper.GetInstance().nHibernateHelper.Get <Dal.ContainerManage.Entities.AscmCheckContainerInfo>(Convert.ToInt32(YnDaoHelper.GetInstance().nHibernateHelper.GetObject("select id from AscmCheckContainerInfo where containerId='" + strSn + "' and checkId=" + intcheckId + "")));
                     ascmCheckContainerInfo.status = status;
                     YnDaoHelper.GetInstance().nHibernateHelper.Update <Dal.ContainerManage.Entities.AscmCheckContainerInfo>(ascmCheckContainerInfo);
                     tx.Commit();//正确执行提交
                     return("系统已更新该容器的盘点信息");
                 }
             }
             ascmContainer.isCheck = 1;
             YnDaoHelper.GetInstance().nHibernateHelper.Update <Dal.SupplierPreparation.Entities.AscmContainer>(ascmContainer);
             tx.Commit();//正确执行提交
             return("");
         }
         catch (Exception ex)
         {
             tx.Rollback();//回滚
             YnBaseClass2.Helper.LogHelper.GetLog().Error("保存失败(Save AscmCheckContainerInfo)", ex);
             throw ex;
         }
     }
 }
        public List <AscmDeliveryNotifyMain> GetList(YnPage ynPage, string sortName, string sortOrder, string queryWord, string whereOther)
        {
            List <AscmDeliveryNotifyMain> list = new List <AscmDeliveryNotifyMain>();

            try
            {
                string sort = " order by id ";
                if (!string.IsNullOrEmpty(sortName))
                {
                    sort = " order by " + sortName.Trim() + " ";
                    if (!string.IsNullOrEmpty(sortOrder))
                    {
                        sort += sortOrder.Trim();
                    }
                }
                sort = ""; //不能在里面加order ,否则效率非常低
                //string sql = "from AscmDeliveryNotifyMain ";//where id>36614045
                //string detailCount = "select count(*) from AscmDeliveryNotifyDetail where mainId= a.id";
                //string containerBindNumber = "select t1.quantity from AscmContainerDelivery t1, AscmDeliveryOrderMain t2, AscmDeliveryOrderDetail t3, AscmDeliveryNotifyDetail t4  where t3.notifyDetailId = t4.id and t2.id = t3.mainId and t1.deliveryOrderBatchId=t2.batchId and t4.mainId = a.id";
                //string containerBindNumber = "select sum(t1.quantity) from AscmContainerDelivery t1, (select distinct t2.batchId, t4.mainId from AscmDeliveryOrderMain t2, AscmDeliveryOrderDetail t3, AscmDeliveryNotifyDetail t4  where t3.notifyDetailId = t4.id and t2.id = t3.mainId) t where t1.deliveryOrderBatchId=t.batchId and t.mainId = a.id";

                ////string containerBindNumber = "select sum(t1.quantity) from AscmContainerDelivery t1 where t1.deliveryOrderBatchId in "
                //                              + "(select distinct t2.batchId from AscmDeliveryOrderMain t2, AscmDeliveryOrderDetail t3, AscmDeliveryNotifyDetail t4 "
                //                              + "where t3.notifyDetailId = t4.id and t2.id = t3.mainId and t4.mainId = a.id)";
                //string receiveTime = "select t.acceptTime from AscmDeliBatSumMain t, AscmDeliBatSumDetail t1, AscmDeliveryOrderMain t2, AscmDeliveryOrderDetail t3, AscmDeliveryNotifyDetail t4  where t.id = t1.mainId and t1.batchId = t2.batchId and  t2.id = t3.mainId and t3.notifyDetailId = t4.id and t4.mainId = a.id";
                //string totalNumber = "select sum(deliveryQuantity) from AscmDeliveryOrderDetail where mainId= a.id";
                //string sql1 = "select new AscmDeliveryNotifyMain(a,(" + detailCount + "),(" + containerBindNumber + "),(" + receiveTime + ")) from AscmDeliveryNotifyMain a ";
                //string sql1 = "select new AscmDeliveryNotifyMain(a,(" + detailCount + ")) from AscmDeliveryNotifyMain a left j ";
                //string sql = "select count(a.*) from Ascm_Delivery_Notify_Main a left join Ascm_Delivery_Notify_Detail b on a.id = b.mainId left join Ascm_Delivery_Order_Detail c on b.id = c.notifydetailid left join Ascm_Delivery_Order_Main d on c.mainid = d.id left join ascm_deli_bat_order_link e on d.batchid = e.batchid  ";
                //string sql = "select count(1) from (select distinct a.id from Ascm_Delivery_Notify_Main a left join Ascm_Delivery_Notify_Detail b on a.id = b.mainId left join Ascm_Delivery_Order_Detail c on b.id = c.notifydetailid left join Ascm_Delivery_Order_Main d on c.mainid = d.id left join ascm_deli_bat_order_link e on d.batchid = e.batchid  left join ascm_deli_bat_sum_detail f on e.batchid = f.batchid left join ascm_deli_bat_sum_main g on f.mainid = g.id ";

                //保存ERP上获取的总接收数
                //List<AscmDeliveryNotifyMain> listAscmDeliveryNotifyMain = AscmDeliveryNotifyMainService.GetInstance().GetList(null, "", "", "", whereOther);
                //if (listAscmDeliveryNotifyMain != null && listAscmDeliveryNotifyMain.Count > 0)
                //    AscmDeliveryNotifyMainService.GetInstance().Update(listAscmDeliveryNotifyMain);

                string sql       = "select count(1) from (select distinct a.id from Ascm_Delivery_Notify_Main a ";
                string sql1      = "select distinct a.id ids,a.*,e.batchid,g.accepttime from Ascm_Delivery_Notify_Main a left join Ascm_Delivery_Notify_Detail b on a.id = b.mainId left join Ascm_Delivery_Order_Detail c on b.id = c.notifydetailid left join Ascm_Delivery_Order_Main d on c.mainid = d.id left join ascm_deli_bat_order_link e on d.batchid = e.batchid  left join ascm_deli_bat_sum_detail f on e.batchid = f.batchid left join ascm_deli_bat_sum_main g on f.mainid = g.id ";
                string sql_other = "select t.*, rownum rn from ({0}) t";
                string where = "", whereQueryWord = "";
                if (!string.IsNullOrEmpty(queryWord))
                {
                    whereQueryWord = " (name like '%" + queryWord.Trim() + "%' or description like '%" + queryWord.Trim() + "%')";
                }
                where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);
                where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereOther);

                if (where.IndexOf("a.totalReceiveQuantity") > -1)
                {
                    where = where.Replace("a.totalReceiveQuantity", "nvl(a.totalReceiveQuantity,0)");
                }

                if (!string.IsNullOrEmpty(where))
                {
                    sql  += " where " + where + ")";
                    sql1 += " where " + where;
                    sql1  = string.Format(sql_other, sql1);
                }
                if (whereOther == "")
                {
                    sql1 = "select * from (" + sql1 + " where rownum <=" + ynPage.currentPage * ynPage.pageSize + ") where rn >" + (ynPage.currentPage - 1) * ynPage.pageSize;
                }
                else
                {
                    sql1 = "select * from (" + sql1 + " where rownum <=" + ynPage.currentPage * ynPage.pageSize + ") where rn >" + (ynPage.currentPage - 1) * ynPage.pageSize;
                }
                ArrayList arrayList = (ArrayList)YnDaoHelper.GetInstance().nHibernateHelper.ExecuteReader(sql);
                for (int i = 0; i < arrayList.Count; i++)
                {
                    Object[] o = (Object[])arrayList[i];
                    ynPage.recordCount = int.Parse(o[0].ToString());
                }
                //IList<AscmDeliveryNotifyMain> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find<AscmDeliveryNotifyMain>(sql + sort);
                ArrayList arrayList1 = (ArrayList)YnDaoHelper.GetInstance().nHibernateHelper.ExecuteReader(sql1);
                for (int i = 0; i < arrayList1.Count; i++)
                {
                    Object[] o = (Object[])arrayList1[i];
                    AscmDeliveryNotifyMain a = new AscmDeliveryNotifyMain();
                    int j = 1;
                    a.id                   = int.Parse(o[j + 0].ToString());
                    a.organizationId       = int.Parse(o[j + 1].ToString() == "" ? "0" : o[j + 1].ToString());
                    a.createUser           = o[j + 2].ToString();
                    a.createTime           = o[j + 3].ToString();
                    a.modifyUser           = o[j + 4].ToString();
                    a.modifyTime           = o[j + 5].ToString();
                    a.docNumber            = o[j + 6].ToString();
                    a.supplierId           = int.Parse(o[j + 7].ToString() == "" ? "0" : o[j + 7].ToString());
                    a.warehouseId          = o[j + 8].ToString();
                    a.materialId           = int.Parse(o[j + 9].ToString() == "" ? "0" : o[j + 9].ToString());
                    a.releasedQuantity     = int.Parse(o[j + 10].ToString() == "" ? "0" : o[j + 10].ToString());
                    a.promisedQuantity     = int.Parse(o[j + 11].ToString() == "" ? "0" : o[j + 11].ToString());
                    a.deliveryQuantity     = int.Parse(o[j + 12].ToString() == "" ? "0" : o[j + 12].ToString());
                    a.cancelQuantity       = int.Parse(o[j + 13].ToString() == "" ? "0" : o[j + 13].ToString());
                    a.status               = o[j + 14].ToString();
                    a.releasedTime         = o[j + 15].ToString();
                    a.needTime             = o[j + 16].ToString();
                    a.promisedTime         = o[j + 17].ToString();
                    a.confirmTime          = o[j + 18].ToString();
                    a.comments             = o[j + 19].ToString();
                    a.purchasingAgentId    = int.Parse(o[j + 20].ToString() == "" ? "0" : o[j + 20].ToString());
                    a.wipEntityId          = int.Parse(o[j + 21].ToString() == "" ? "0" : o[j + 21].ToString());
                    a.departmentId         = int.Parse(o[j + 22].ToString() == "" ? "0" : o[j + 22].ToString());
                    a.locationId           = int.Parse(o[j + 23].ToString() == "" ? "0" : o[j + 23].ToString());
                    a.fdSourceType         = o[j + 24].ToString();
                    a.appointmentStartTime = o[j + 25].ToString();
                    a.appointmentEndTime   = o[j + 26].ToString();
                    a.totalReceiveQuantity = int.Parse(o[j + 28].ToString() == "" ? "0" : o[j + 28].ToString());
                    string    sql2       = "select sum(a.quantity) from ascm_container_delivery a where a.DELIVERYORDERBATCHID = '" + o[j + 29].ToString() + "'";
                    ArrayList arrayList2 = (ArrayList)YnDaoHelper.GetInstance().nHibernateHelper.ExecuteReader(sql2);
                    for (int i1 = 0; i1 < arrayList2.Count; i1++)
                    {
                        Object[] o1 = (Object[])arrayList2[i1];
                        a.containerBindQuantity = int.Parse(o1[0].ToString() == "" ? "0" : o1[0].ToString());
                    }
                    a.receiveTime = o[j + 30].ToString();
                    list.Add(a);
                }
                //IList<AscmDeliveryNotifyMain> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find<AscmDeliveryNotifyMain>(sql1 + sort, sql, ynPage);
                //if (ilist != null)
                //{
                //list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList<AscmDeliveryNotifyMain>(ilist);
                SetSupplier(list);
                SetMaterial(list);
                SetCreateUser(list);
                SetWipEntities(list);
                SetBomDepartments(list);
                SetHrLocations(list);
                SetLookupValues(list);
                getShipmentQuantities(list);
                //}
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmDeliveryNotifyMain)", ex);
                throw ex;
            }
            return(list);
        }
Esempio n. 20
0
        public string SuplierSiteCode()
        {
            string hql = "from  AscmSupplier where id in (select DISTINCT supplierId from AscmContainer)";
            IList <MideaAscm.Dal.Base.Entities.AscmSupplier> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <MideaAscm.Dal.Base.Entities.AscmSupplier>(hql);
            List <MideaAscm.Dal.Base.Entities.AscmSupplier>  list  = null;

            if (ilist != null && ilist.Count > 0)
            {
                list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <MideaAscm.Dal.Base.Entities.AscmSupplier>(ilist);
                System.Text.StringBuilder sbSn = new System.Text.StringBuilder();
                sbSn.Clear();
                var q = list.Select(e => e.id).Distinct();
                foreach (int supplierId in q)
                {
                    if (sbSn.Length != 0)
                    {
                        sbSn.Append(",");
                    }
                    sbSn.AppendFormat("{0}", supplierId);
                }
                if (string.IsNullOrEmpty(sbSn.ToString()))
                {
                    return("");
                }
                IList <MideaAscm.Dal.Base.Entities.AscmSupplierAddress> ilistII             = YnDaoHelper.GetInstance().nHibernateHelper.Find <MideaAscm.Dal.Base.Entities.AscmSupplierAddress>("from AscmSupplierAddress where vendorId in (" + sbSn.ToString() + ")");
                List <MideaAscm.Dal.Base.Entities.AscmSupplierAddress>  listAscmReadingHead = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList(ilistII);
                if (ilist.Count > 0)
                {
                    foreach (Dal.Base.Entities.AscmSupplier ascmTagLog in list)
                    {
                        if (ascmTagLog.id == 6128)
                        {
                            ascmTagLog.name = "美的";
                        }
                        else
                        {
                            ascmTagLog.name = listAscmReadingHead.Find(e => e.vendorId == ascmTagLog.id).vendorSiteCode;
                        }
                    }
                }
            }
            return(YnBaseClass2.Helper.ObjectHelper.Serialize(list));
        }
Esempio n. 21
0
        /*
         *  2014/5/12 by chenyao
         */
        public List <AscmCuxWipReleaseHeaders> GetList(YnPage ynPage, string releaseNumber, string startScheduledStartDate, string endScheduledStartDate, int?statusType)
        {
            List <AscmCuxWipReleaseHeaders> list = null;
            string sql = "select {0} from cux_wip_release_headers wrh,wip_discrete_jobs wdj,wip_entities we,mtl_system_items_b msib";

            string where = string.Empty;
            where        = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, "wrh.wip_entity_id = wdj.wip_entity_id");
            where        = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, "wdj.wip_entity_id = we.wip_entity_id");
            where        = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, "wdj.primary_item_id = msib.inventory_item_id");
            where        = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, "wdj.organization_id = 775");
            where        = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, "wrh.organization_id = 775");
            where        = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, "wrh.release_type = 'ISSUE'");
            if (!string.IsNullOrWhiteSpace(releaseNumber))
            {
                where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, "wrh.release_number = '" + releaseNumber.Trim() + "'");
            }
            string   whereStartScheduledStartDate = "", whereEndScheduledStartDate = "";
            DateTime dtStartScheduledStartDate, dtEndScheduledStartDate;

            if (!string.IsNullOrEmpty(startScheduledStartDate) && DateTime.TryParse(startScheduledStartDate, out dtStartScheduledStartDate))
            {
                whereStartScheduledStartDate = "wdj.scheduled_start_date >= to_date('" + dtStartScheduledStartDate.ToString("yyyy-MM-dd 00:00") + "', 'yyyy-mm-dd hh24:mi')";
                whereEndScheduledStartDate   = "wdj.scheduled_start_date < to_date('" + dtStartScheduledStartDate.AddDays(1).ToString("yyyy-MM-dd 00:00") + "', 'yyyy-mm-dd hh24:mi')";
            }
            if (!string.IsNullOrEmpty(endScheduledStartDate) && DateTime.TryParse(endScheduledStartDate, out dtEndScheduledStartDate))
            {
                whereEndScheduledStartDate = "wdj.scheduled_start_date < to_date('" + dtEndScheduledStartDate.AddDays(1).ToString("yyyy-MM-dd 00:00") + "', 'yyyy-mm-dd hh24:mi')";
            }
            where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereStartScheduledStartDate);
            where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereEndScheduledStartDate);
            if (statusType.HasValue)
            {
                where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, "wdj.status_type = " + statusType.Value);
            }
            sql += " where " + where;

            string selectCount = string.Format(sql, "count(1)");

            sql  = string.Format(sql, "wrh.release_header_id,wrh.release_number,wrh.wip_entity_id,we.wip_entity_name,wdj.scheduled_start_date,wdj.wip_supply_type,wdj.schedule_group_id,wdj.net_quantity,wdj.status_type,wdj.description,msib.segment1");
            sql += " order by wrh.release_header_id";

            OracleParameter[] commandParameters = new OracleParameter[] {
                new OracleParameter {
                    ParameterName = "i_sql",
                    OracleDbType  = OracleDbType.Varchar2,
                    Size          = 2000,
                    Value         = sql,
                    Direction     = ParameterDirection.Input
                },
                new OracleParameter {
                    ParameterName = "i_sql_count",
                    OracleDbType  = OracleDbType.Varchar2,
                    Size          = 2000,
                    Value         = selectCount,
                    Direction     = ParameterDirection.Input
                },
                new OracleParameter {
                    ParameterName = "i_pagesize",
                    OracleDbType  = OracleDbType.Int32,
                    Value         = ynPage.pageSize,
                    Direction     = ParameterDirection.Input
                },
                new OracleParameter {
                    ParameterName = "i_currentpage",
                    OracleDbType  = OracleDbType.Int32,
                    Value         = ynPage.currentPage,
                    Direction     = ParameterDirection.Input
                },
                new OracleParameter {
                    ParameterName = "o_totalcount",
                    OracleDbType  = OracleDbType.Int32,
                    Direction     = ParameterDirection.Output
                },
                new OracleParameter {
                    ParameterName = "o_pagecount",
                    OracleDbType  = OracleDbType.Int32,
                    Direction     = ParameterDirection.Output
                },
                new OracleParameter {
                    ParameterName = "o_cursor",
                    OracleDbType  = OracleDbType.RefCursor,
                    Direction     = ParameterDirection.Output
                }
            };

            try
            {
                ISession      session = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession();
                OracleCommand command = (OracleCommand)session.Connection.CreateCommand();
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "cux_ascm_interface_utl.sp_exec_page";
                Array.ForEach <OracleParameter>(commandParameters, P => command.Parameters.Add(P));
                OracleDataAdapter da = new OracleDataAdapter(command);
                DataSet           ds = new DataSet();
                da.Fill(ds);
                DataTable dt = ds.Tables[0];

                if (dt != null && dt.Rows != null && dt.Rows.Count > 0)
                {
                    list = new List <AscmCuxWipReleaseHeaders>();
                    foreach (DataRow dr in dt.Rows)
                    {
                        AscmCuxWipReleaseHeaders cuxWipReleaseHeaders = new AscmCuxWipReleaseHeaders();
                        cuxWipReleaseHeaders.releaseHeaderId      = Convert.ToInt32(dr["release_header_id"]);
                        cuxWipReleaseHeaders.releaseNumber        = dr["release_number"].ToString();
                        cuxWipReleaseHeaders.wipEntityId          = Convert.ToInt32(dr["wip_entity_id"]);
                        cuxWipReleaseHeaders.wipEntityName        = dr["wip_entity_name"].ToString();
                        cuxWipReleaseHeaders.scheduledStartDate   = dr["scheduled_start_date"].ToString();
                        cuxWipReleaseHeaders.wipSupplyType        = Convert.ToInt32(dr["wip_supply_type"]);
                        cuxWipReleaseHeaders.scheduleGroupId      = Convert.ToInt32(dr["schedule_group_id"]);
                        cuxWipReleaseHeaders.netQuantity          = Convert.ToDecimal(dr["net_quantity"]);
                        cuxWipReleaseHeaders.statusType           = Convert.ToInt32(dr["status_type"]);
                        cuxWipReleaseHeaders.description          = dr["description"].ToString();
                        cuxWipReleaseHeaders.primaryItemDocNumber = dr["segment1"].ToString();
                        list.Add(cuxWipReleaseHeaders);
                    }
                }

                int totalCount = 0;
                int.TryParse(commandParameters[4].Value.ToString(), out totalCount);
                ynPage.SetRecordCount(totalCount);

                int pageCount = 0;
                int.TryParse(commandParameters[5].Value.ToString(), out pageCount);
                ynPage.pageCount = pageCount;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(list);
        }
Esempio n. 22
0
        public List <AscmWarelocation> GetList(YnPage ynPage, string sortName, string sortOrder, string queryWord, string whereOther,
                                               bool isSetWorkshopBuilding = true, bool isSetWarehouse = true, bool isSetWarehouseUser = true)
        {
            List <AscmWarelocation> list = null;

            try
            {
                string sort = " order by docNumber ";
                if (!string.IsNullOrEmpty(sortName))
                {
                    sort = " order by " + sortName.Trim() + " ";
                    if (!string.IsNullOrEmpty(sortOrder))
                    {
                        sort += sortOrder.Trim();
                    }
                }
                string sql = "from AscmWarelocation ";

                string totalNumber = "select sum(quantity) from AscmLocationMaterialLink where warelocationId=a.id";
                string sql1        = "select new AscmWarelocation(a,(" + totalNumber + ")) from AscmWarelocation a";

                string where = "", whereQueryWord = "";
                if (!string.IsNullOrEmpty(queryWord))
                {
                    whereQueryWord = " upper(docNumber) like '%" + queryWord.Trim().ToUpper() + "%' or upper(categoryCode) like '%" + queryWord.Trim().ToUpper() + "%'";
                }
                where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);
                where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereOther);

                if (!string.IsNullOrEmpty(where))
                {
                    sql  += " where " + where;
                    sql1 += " where " + where;
                }

                IList <AscmWarelocation> ilist = null;
                if (ynPage != null)
                {
                    ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmWarelocation>(sql1 + sort, sql, ynPage);
                }
                else
                {
                    ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmWarelocation>(sql1 + sort);
                }
                if (ilist != null)
                {
                    list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmWarelocation>(ilist);
                    if (isSetWorkshopBuilding)
                    {
                        SetWorkshopBuilding(list);
                    }
                    if (isSetWarehouse)
                    {
                        SetWarehouse(list);
                    }
                    if (isSetWarehouseUser)
                    {
                        SetWarehouseUser(list);
                    }
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmWarelocation)", ex);
                throw ex;
            }
            return(list);
        }
Esempio n. 23
0
        public void SetBomPrepareQuantity(List <AscmWmsPreparationDetail> list)
        {
            if (list == null || list.Count == 0)
            {
                return;
            }

            var    wipEntityIds = list.Select(P => P.wipEntityId).Distinct();
            var    count        = wipEntityIds.Count();
            string ids          = string.Empty;

            for (int i = 0; i < count; i++)
            {
                if (!string.IsNullOrEmpty(ids))
                {
                    ids += ",";
                }
                ids += wipEntityIds.ElementAt(i);
                if ((i + 1) % 500 == 0 || (i + 1) == count)
                {
                    if (!string.IsNullOrEmpty(ids))
                    {
                        List <AscmWmsPreparationDetail> _list = list.FindAll(P => ids.Split(',').Contains(P.wipEntityId.ToString()));
                        string materialIds = string.Join(",", _list.Select(P => P.materialId).Distinct());
                        string hql         = "from AscmWipRequirementOperations where wipEntityId in(" + ids + ") and inventoryItemId in(" + materialIds + ")";
                        IList <AscmWipRequirementOperations> ilistWipRequirementOperations = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmWipRequirementOperations>(hql);
                        if (ilistWipRequirementOperations != null && ilistWipRequirementOperations.Count > 0)
                        {
                            List <AscmWipRequirementOperations> listWipRequirementOperations = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmWipRequirementOperations>(ilistWipRequirementOperations);
                            foreach (AscmWmsPreparationDetail preparationDetail in list)
                            {
                                AscmWipRequirementOperations wipRequirementOperations = listWipRequirementOperations.Find(P => P.wipEntityId == preparationDetail.wipEntityId && P.inventoryItemId == preparationDetail.materialId);
                                if (wipRequirementOperations != null)
                                {
                                    preparationDetail.containerBindNumber = wipRequirementOperations.ascmPreparedQuantity;
                                }
                            }
                        }
                    }
                    ids = string.Empty;
                }
            }
        }
Esempio n. 24
0
        public List <AscmCuxWipReleaseHeaders> GetList(YnPage ynPage, string sortName, string sortOrder, string queryWord, string whereOther, string whereWipDiscreteJobs)
        {
            List <AscmCuxWipReleaseHeaders> list = null;

            try
            {
                string whereWipEntityId = "";
                if (!string.IsNullOrEmpty(whereWipDiscreteJobs))
                {
                    //List<AscmWipDiscreteJobs> listWipDiscreteJobs = AscmWipDiscreteJobsService.GetInstance().GetList(ynPage, "", "", queryWord, whereWipDiscreteJobs);
                    List <AscmWipDiscreteJobs> listWipDiscreteJobs = AscmWipDiscreteJobsService.GetInstance().GetList(null, "", "", "", whereWipDiscreteJobs, false, false, false, false);
                    int    iCount = listWipDiscreteJobs.Count();
                    string ids    = string.Empty;
                    for (int i = 0; i < iCount; i++)
                    {
                        if (!string.IsNullOrEmpty(ids))
                        {
                            ids += ",";
                        }
                        ids += listWipDiscreteJobs[i].wipEntityId;
                        if ((i + 1) % 1000 == 0 || i + 1 == iCount)
                        {
                            if (!string.IsNullOrEmpty(ids))
                            {
                                if (!string.IsNullOrEmpty(whereWipEntityId))
                                {
                                    whereWipEntityId += " or ";
                                }
                                whereWipEntityId += "wipEntityId in ( " + ids + ")";
                            }
                            ids = string.Empty;
                        }
                    }
                    if (string.IsNullOrEmpty(whereWipEntityId))
                    {
                        whereWipEntityId = "wipEntityId in ( -1)";
                    }
                    //foreach (AscmWipDiscreteJobs ascmWipDiscreteJobs in listWipDiscreteJobs)
                    //{
                    //    if (whereWipEntityId != "")
                    //        whereWipEntityId += ",";
                    //    whereWipEntityId += ascmWipDiscreteJobs.wipEntityId;
                    //}
                    //if (!string.IsNullOrEmpty(whereWipEntityId))
                    //    whereWipEntityId = "wipEntityId in ( " + whereWipEntityId + ")";
                    //else
                    //    whereWipEntityId = "wipEntityId in ( -1)";
                }
                string sort = " order by releaseHeaderId ";
                if (!string.IsNullOrEmpty(sortName))
                {
                    sort = " order by " + sortName.Trim() + " ";
                    if (!string.IsNullOrEmpty(sortOrder))
                    {
                        sort += sortOrder.Trim();
                    }
                }
                //sort = ""; //不能在里面加order ,否则效率非常低
                string sql = "from AscmCuxWipReleaseHeaders";
                //string detailCount = "select count(*) from AscmCuxWipReleaseLines where releaseHeaderId= a.releaseHeaderId";
                //string totalNumber = "select sum(deliveryQuantity) from AscmDeliveryOrderDetail where mainId= a.id";
                //string sql1 = "select new AscmCuxWipReleaseHeaders(a,(" + detailCount + "),(" + totalNumber + ")) from AscmCuxWipReleaseHeaders a ";
                string sql1 = "select new AscmCuxWipReleaseHeaders(a) from AscmCuxWipReleaseHeaders a ";//,(" + detailCount + ")

                string where = "", whereQueryWord = "";
                if (!string.IsNullOrEmpty(queryWord))
                {
                    whereQueryWord = " (name like '%" + queryWord.Trim() + "%' or description like '%" + queryWord.Trim() + "%')";
                }
                where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);
                where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereOther);
                where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereWipEntityId);

                if (!string.IsNullOrEmpty(where))
                {
                    sql  += " where " + where;
                    sql1 += " where " + where;
                }
                //IList<AscmCuxWipReleaseHeaders> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find<AscmCuxWipReleaseHeaders>(sql + sort);
                IList <AscmCuxWipReleaseHeaders> ilist = null;
                if (ynPage != null)
                {
                    ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmCuxWipReleaseHeaders>(sql1 + sort, sql, ynPage);
                }
                else
                {
                    ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmCuxWipReleaseHeaders>(sql1 + sort);
                }
                if (ilist != null)
                {
                    list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmCuxWipReleaseHeaders>(ilist);
                    SetWipEntities(list);
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmCuxWipReleaseHeaders)", ex);
                throw ex;
            }
            return(list);
        }
Esempio n. 25
0
        public List <AscmGetMaterialLog> GetList(YnPage ynPage, string sortName, string sortOrder, string queryWord, string whereOther)
        {
            List <AscmGetMaterialLog> list = new List <AscmGetMaterialLog>();

            try
            {
                string sort = "";
                if (!string.IsNullOrEmpty(sortName))
                {
                    sort = " order by " + sortName.Trim() + " ";
                    if (!string.IsNullOrEmpty(sortOrder))
                    {
                        sort += sortOrder.Trim();
                    }
                }
                else
                {
                    sort = " order by id ";
                }

                string sql = " from AscmGetMaterialLog ";
                string where = "", whereQueryWord = "";
                if (!string.IsNullOrEmpty(queryWord))
                {
                    whereQueryWord = "workerId like '%" + queryWord + "%'";
                    where          = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);
                }
                where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereOther);

                if (!string.IsNullOrEmpty(where))
                {
                    sql += " where " + where;
                }
                if (!string.IsNullOrEmpty(sort))
                {
                    sql += sort;
                }

                IList <AscmGetMaterialLog> ilist = null;
                if (ynPage != null)
                {
                    ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmGetMaterialLog>(sql, sql, ynPage);
                }
                else
                {
                    ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmGetMaterialLog>(sql);
                }

                if (ilist != null && ilist.Count > 0)
                {
                    list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmGetMaterialLog>(ilist);
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Get AscmGetMaterialLog)", ex);
                throw ex;
            }

            return(list);
        }
        /// <summary>存操作:保存货位转移信息,并返回其ID</summary>
        public void UpdateWmsLocationTransfer(AscmWmsLocationTransfer ascmWmsLocationTransfer)
        {
            try
            {
                if (ascmWmsLocationTransfer == null)
                {
                    throw new Exception("获取货位转移信息失败");
                }

                string sql = "from AscmLocationMaterialLink "
                             + "where warelocationId in(" + ascmWmsLocationTransfer.fromWarelocationId + "," + ascmWmsLocationTransfer.toWarelocationId + ") "
                             + "and materialId=" + ascmWmsLocationTransfer.materialId;

                IList <AscmLocationMaterialLink> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmLocationMaterialLink>(sql);
                if (ilist == null || ilist.Count == 0)
                {
                    throw new Exception("获取货位失败");
                }
                AscmLocationMaterialLink fromLocationMaterialLink = ilist.First(P => P.pk.warelocationId == ascmWmsLocationTransfer.fromWarelocationId);
                if (fromLocationMaterialLink == null)
                {
                    throw new Exception("获取来源货位失败");
                }
                DateTime dtServerTime = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentDate("AscmLocationMaterialLink");
                List <AscmLocationMaterialLink> listLocationMaterialLinkSaveOrUpdate = new List <AscmLocationMaterialLink>();

                fromLocationMaterialLink.quantity  -= ascmWmsLocationTransfer.quantity;
                fromLocationMaterialLink.modifyTime = dtServerTime.ToString("yyyy-MM-dd HH:mm:ss");
                fromLocationMaterialLink.modifyUser = ascmWmsLocationTransfer.modifyUser;
                listLocationMaterialLinkSaveOrUpdate.Add(fromLocationMaterialLink);

                AscmLocationMaterialLink toLocationMaterialLink = null;
                toLocationMaterialLink = ilist.First(P => P.pk.warelocationId == ascmWmsLocationTransfer.toWarelocationId);
                //如果货位之前没存放此物料,则新增
                if (toLocationMaterialLink == null)
                {
                    toLocationMaterialLink = new AscmLocationMaterialLink();
                    int maxId = YnDaoHelper.GetInstance().nHibernateHelper.GetMaxId("select max(id) from AscmWmsLocationTransfer");
                    //toLocationMaterialLink.id = ++maxId;
                    toLocationMaterialLink.createTime = dtServerTime.ToString("yyyy-MM-dd HH:mm:ss");
                    toLocationMaterialLink.createUser = ascmWmsLocationTransfer.modifyUser;
                    //toLocationMaterialLink.warelocationId = ascmWmsLocationTransfer.toWarelocationId;
                    //toLocationMaterialLink.materialId = ascmWmsLocationTransfer.materialId;
                    toLocationMaterialLink.pk = new AscmLocationMaterialLinkPK {
                        warelocationId = ascmWmsLocationTransfer.toWarelocationId, materialId = ascmWmsLocationTransfer.materialId
                    };
                }
                toLocationMaterialLink.modifyTime = dtServerTime.ToString("yyyy-MM-dd HH:mm:ss");
                toLocationMaterialLink.modifyUser = ascmWmsLocationTransfer.modifyUser;
                toLocationMaterialLink.quantity  += ascmWmsLocationTransfer.quantity;
                listLocationMaterialLinkSaveOrUpdate.Add(toLocationMaterialLink);

                using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
                {
                    try
                    {
                        YnDaoHelper.GetInstance().nHibernateHelper.Update(ascmWmsLocationTransfer);

                        YnDaoHelper.GetInstance().nHibernateHelper.SaveOrUpdateList(listLocationMaterialLinkSaveOrUpdate);

                        tx.Commit();//正确执行提交
                    }
                    catch (Exception ex)
                    {
                        tx.Rollback();//回滚
                        throw ex;
                    }
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("增加失败(Update AscmWmsLocationTransfer)", ex);
                throw ex;
            }
        }
Esempio n. 27
0
        public List <AscmDeliveryOrderBatch> GetList(YnPage ynPage, string sortName, string sortOrder, string queryWord, string whereOther)
        {
            List <AscmDeliveryOrderBatch> list = null;

            try
            {
                string sort = " order by id ";
                if (!string.IsNullOrEmpty(sortName))
                {
                    sort = " order by " + sortName.Trim() + " ";
                    if (!string.IsNullOrEmpty(sortOrder))
                    {
                        sort += sortOrder.Trim();
                    }
                }
                sort = ""; //不能在里面加order ,否则效率非常低
                string sql         = "from AscmDeliveryOrderBatch";
                string _materialId = "select materialId from AscmDeliveryOrderDetail where mainId in (select id from AscmDeliveryOrderMain where batchId =a.id) and  rownum=1";
                string detailCount = "select count(*) from AscmDeliveryOrderDetail where mainId in (select id from AscmDeliveryOrderMain where batchId =a.id)";
                string totalNumber = "select sum(deliveryQuantity) from AscmDeliveryOrderDetail where mainId in (select id from AscmDeliveryOrderMain where batchId = a.id)";
                //string appointmentStartTime = "select appointmentStartTime from AscmDeliveryNotifyMain where id = (select mainId from AscmDeliveryNotifyDetail where id=(select notifyDetailId from AscmDeliveryOrderDetail where mainId = (select id from AscmDeliveryOrderMain where batchId =a.id)))";
                //string appointmentEndTime = "select appointmentEndTime from AscmDeliveryNotifyMain where id = (select mainId from AscmDeliveryNotifyDetail where id=(select notifyDetailId from AscmDeliveryOrderDetail where mainId = (select id from AscmDeliveryOrderMain where batchId =a.id)))";
                string sql1 = "select new AscmDeliveryOrderBatch(a,(" + detailCount + "),(" + totalNumber + "),(" + _materialId + ")) from AscmDeliveryOrderBatch a ";

                string where = "", whereQueryWord = "";
                if (!string.IsNullOrEmpty(queryWord))
                {
                    whereQueryWord = " (barCode like '%" + queryWord.Trim() + "%')";
                }
                //whereQueryWord = " (name like '%" + queryWord.Trim() + "%' or description like '%" + queryWord.Trim() + "%')";
                where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);
                where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereOther);

                if (!string.IsNullOrEmpty(where))
                {
                    sql  += " where " + where;
                    sql1 += " where " + where;
                }

                //IList<AscmDeliveryOrderBatch> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find<AscmDeliveryOrderBatch>(sql + sort);
                IList <AscmDeliveryOrderBatch> ilist = null;
                if (ynPage != null)
                {
                    ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmDeliveryOrderBatch>(sql1 + sort, sql, ynPage);
                }
                else
                {
                    ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmDeliveryOrderBatch>(sql1 + sort);
                }
                if (ilist != null)
                {
                    list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmDeliveryOrderBatch>(ilist);
                    SetSupplier(list);
                    SetMaterial(list);
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmDeliveryOrderBatch)", ex);
                throw ex;
            }
            return(list);
        }
        public List <AscmWmsLocationTransfer> GetList(YnPage ynPage, string sortName, string sortOrder, string queryWord, string whereOther, bool IsSetMaterialItem = true, bool IsSetToWarelocation = true, bool IsSetFromWarelocation = true)
        {
            List <AscmWmsLocationTransfer> list = null;

            try
            {
                string sort = " order by id ";
                if (!string.IsNullOrEmpty(sortName))
                {
                    sort = " order by " + sortName.Trim() + " ";
                    if (!string.IsNullOrEmpty(sortOrder))
                    {
                        sort += sortOrder.Trim();
                    }
                }
                string sql = "from AscmWmsLocationTransfer ";

                string where = "", whereQueryWord = "";
                if (!string.IsNullOrEmpty(queryWord))
                {
                }
                where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);
                where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereOther);

                if (!string.IsNullOrEmpty(where))
                {
                    sql += " where " + where;
                }

                IList <AscmWmsLocationTransfer> ilist = null;
                if (ynPage != null)
                {
                    ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmWmsLocationTransfer>(sql + sort, sql, ynPage);
                }
                else
                {
                    ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmWmsLocationTransfer>(sql + sort);
                }
                if (ilist != null)
                {
                    list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmWmsLocationTransfer>(ilist);
                    if (IsSetMaterialItem)
                    {
                        SetMaterialItem(list);
                    }
                    if (IsSetToWarelocation)
                    {
                        SetToWarelocation(list);
                    }
                    if (IsSetFromWarelocation)
                    {
                        SetFromWarelocation(list);
                    }
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmWmsLocationTransfer)", ex);
                throw ex;
            }
            return(list);
        }
Esempio n. 29
0
        //车辆入厂
        public void InOutPlant(int doorId, string readingHead, int driverId, bool inPlant, string direction, bool onTime, ref string allocateOutDoor)
        {
            try
            {
                AscmDriver ascmDriver = Get(driverId);
                if (ascmDriver != null)
                {
                    int    batSumMainId         = 0;
                    string batSumDocNumber      = string.Empty;
                    string appointmentStartTime = string.Empty;
                    string appointmentEndTime   = string.Empty;

                    SetSupplier(new List <AscmDriver> {
                        ascmDriver
                    });

                    List <AscmDeliBatSumMain> list = AscmDeliBatSumMainService.GetInstance().GetByDriverId(ascmDriver.id);
                    if (list != null)
                    {
                        foreach (AscmDeliBatSumMain ascmDeliBatSumMain in list)
                        {
                            if (inPlant)
                            {
                                ascmDeliBatSumMain.status          = AscmDeliBatSumMain.StatusDefine.inPlant;
                                ascmDeliBatSumMain.toPlantTime     = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                                ascmDeliBatSumMain.allocateOutDoor = "北门";
                                if (ascmDeliBatSumMain.warehouseId != "W112材料")
                                {
                                    #region 取上一次送货合单
                                    YnPage ynPage = new YnPage();
                                    ynPage.SetPageSize(1);
                                    ynPage.SetCurrentPage(1);
                                    //string sort = " order by toPlantTime desc ";
                                    string where = " toPlantTime is not null and status='" + AscmDeliBatSumMain.StatusDefine.inPlant + "'";
                                    List <AscmDeliBatSumMain> listAscmDeliBatSumMainPreviousInPlant = AscmDeliBatSumMainService.GetInstance().GetList(ynPage, "toPlantTime", "desc", where);
                                    if (listAscmDeliBatSumMainPreviousInPlant != null && listAscmDeliBatSumMainPreviousInPlant.Count > 0)
                                    {
                                        AscmDeliBatSumMain ascmDeliBatSumMain_tmp = listAscmDeliBatSumMainPreviousInPlant[0];
                                        if (ascmDeliBatSumMain_tmp.allocateOutDoor == "北门")
                                        {
                                            ascmDeliBatSumMain.allocateOutDoor = "西门";
                                        }
                                    }
                                    #endregion
                                }
                                batSumMainId         = ascmDeliBatSumMain.id;
                                batSumDocNumber      = ascmDeliBatSumMain.docNumber;
                                appointmentStartTime = ascmDeliBatSumMain.appointmentStartTime;
                                appointmentEndTime   = ascmDeliBatSumMain.appointmentEndTime;
                                allocateOutDoor      = ascmDeliBatSumMain.allocateOutDoor;
                            }
                            else
                            {
                            }

                            DateTime          createTime        = DateTime.Now;
                            string            description       = ascmDriver.supplierName + ":" + ascmDriver.name + ":" + ascmDriver.plateNumber;
                            AscmTruckSwipeLog ascmTruckSwipeLog = AscmTruckSwipeLogService.GetInstance().GetAddLog(doorId, readingHead, ascmDriver.rfid, ascmDriver.supplierId, driverId,
                                                                                                                   ascmDriver.supplierName, ascmDriver.name, ascmDriver.plateNumber, true, description, createTime, direction, batSumMainId, batSumDocNumber,
                                                                                                                   onTime, appointmentStartTime, appointmentEndTime);
                            using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
                            {
                                try
                                {
                                    if (ascmTruckSwipeLog != null)
                                    {
                                        YnDaoHelper.GetInstance().nHibernateHelper.Save(ascmTruckSwipeLog);
                                    }
                                    if (ascmDeliBatSumMain != null)
                                    {
                                        YnDaoHelper.GetInstance().nHibernateHelper.Update(ascmDeliBatSumMain);
                                    }
                                    tx.Commit();//正确执行提交
                                }
                                catch (Exception ex)
                                {
                                    tx.Rollback();//回滚
                                    throw ex;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 30
0
        public List <AscmLogisticsClassInfo> GetList(YnPage ynPage, string sortName, string sortOrder, string queryWord, string whereOhter, bool isSetGroupLeader = true, bool isSetMonitorLeader = true)
        {
            List <AscmLogisticsClassInfo> list = null;

            try
            {
                string sort = " order by id ";
                if (!string.IsNullOrEmpty(sortName))
                {
                    sort = " order by " + sortName.Trim() + " ";
                    if (!string.IsNullOrEmpty(sortOrder))
                    {
                        sort += sortOrder.Trim();
                    }
                }
                string sql = " from AscmLogisticsClassInfo ";

                string where = "", whereQueryWord = "";
                if (!string.IsNullOrEmpty(queryWord))
                {
                    string whereWord = string.Empty;
                    whereQueryWord = "groupLeader = '" + queryWord.Trim() + "'";
                    whereWord      = YnBaseClass2.Helper.StringHelper.SqlWhereOrAdd(whereWord, whereQueryWord);
                    whereQueryWord = "monitorLeader = '" + queryWord.Trim() + "'";
                    whereWord      = YnBaseClass2.Helper.StringHelper.SqlWhereOrAdd(whereWord, whereQueryWord);

                    whereWord = "(" + whereWord + ")";
                    where     = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereWord);
                }
                where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);
                where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereOhter);

                if (!string.IsNullOrEmpty(where))
                {
                    sql += " where " + where;
                }
                if (!string.IsNullOrEmpty(sort))
                {
                    sql += sort;
                }
                IList <AscmLogisticsClassInfo> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmLogisticsClassInfo>(sql, sql, ynPage);
                if (ilist != null)
                {
                    list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmLogisticsClassInfo>(ilist);
                    if (isSetGroupLeader)
                    {
                        SetGroupLeader(list);
                    }
                    if (isSetMonitorLeader)
                    {
                        SetMonitorLeader(list);
                    }
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Get AscmLogisticsClassInfo)", ex);
                throw ex;
            }
            return(list);
        }