public static AscmCuxWipReleaseHeadersService GetInstance()
 {
     //return ascmDeliveryOrderMainServices ?? new AscmCuxWipReleaseHeadersService();
     if (ascmDeliveryOrderMainServices == null)
         ascmDeliveryOrderMainServices = new AscmCuxWipReleaseHeadersService();
     return ascmDeliveryOrderMainServices;
 }
Exemple #2
0
 public static AscmCuxWipReleaseHeadersService GetInstance()
 {
     //return ascmDeliveryOrderMainServices ?? new AscmCuxWipReleaseHeadersService();
     if (ascmDeliveryOrderMainServices == null)
     {
         ascmDeliveryOrderMainServices = new AscmCuxWipReleaseHeadersService();
     }
     return(ascmDeliveryOrderMainServices);
 }
Exemple #3
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);
        }