/// <summary>
        ///
        /// </summary>
        /// <param name="fields"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool UpdateInfo(string fields, long id)
        {
            ///发单状态⑪为10未发单才允许被修改
            string sendTimeStatus = CommonBLL.GetFieldValue(fields, "SEND_TIME_STATUS");

            if (Convert.ToInt32(sendTimeStatus) != (int)SendTimeStatusConstants.NoSend)
            {
                throw new Exception("Err_:MC:0x00000741");///未发单状态窗口时间才允许修改
            }
            string          windowTime      = CommonBLL.GetFieldValue(fields, "WINDOW_TIME");
            string          workDay         = CommonBLL.GetFieldValue(fields, "WORK_DAY");
            string          partBoxCode     = CommonBLL.GetFieldValue(fields, "PART_BOX_CODE");
            PlanPartBoxInfo planPartBoxInfo = new PlanPartBoxDAL().GetInfo(partBoxCode);

            if (planPartBoxInfo == null)
            {
                throw new Exception("Err_:MC:0x00000738");///请选择有效的零件类代码
            }
            ///工作日⑧默认为当天日期,在窗口时间⑩填写完成时自动根据零件类中对应的几个时间合计扣减得到发单时间⑨,发单时间⑨不可编辑
            DateTime windowDateTime = DateTime.Parse(DateTime.Parse(workDay).ToString("yyyy-MM-dd") + " " + DateTime.Parse(windowTime).ToString("HH:mm:ss"));
            int      sumTime        = planPartBoxInfo.PickUpTime.GetValueOrDefault() + planPartBoxInfo.DeliveryTime.GetValueOrDefault() + planPartBoxInfo.DelayTime.GetValueOrDefault();
            DateTime sendDateTime   = windowDateTime.AddMinutes(sumTime * -1);

            fields = CommonBLL.SetFieldValue(fields, "WINDOW_TIME", windowDateTime.ToString("yyyy-MM-dd HH:mm:ss"));
            fields = CommonBLL.SetFieldValue(fields, "SEND_TIME", sendDateTime.ToString("yyyy-MM-dd HH:mm:ss"));
            ///相同零件类代码②、工作日⑧、窗口时间⑩的数据不允许重复
            int cnt = dal.GetCounts("[ID] <> " + id + " and [PART_BOX_CODE] = N'" + partBoxCode + "' and [WINDOW_TIME] = N'" + windowDateTime + "'");

            if (cnt > 0)
            {
                throw new Exception("Err_:MC:0x00000740");///相同零件类、工作日的窗口时间不能重复
            }
            return(dal.UpdateInfo(fields, id) > 0 ? true : false);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="fields"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool UpdateInfo(string fields, long id)
        {
            string   plant        = CommonBLL.GetFieldValue(fields, "PLANT");
            string   workshop     = CommonBLL.GetFieldValue(fields, "WORKSHOP");
            string   assemblyLine = CommonBLL.GetFieldValue(fields, "ASSEMBLY_LINE");
            DateTime date         = DateTime.Parse(CommonBLL.GetFieldValue(fields, "DATE"));
            DateTime beginTime    = DateTime.Parse(CommonBLL.GetFieldValue(fields, "BEGIN_TIME"));
            DateTime endTime      = DateTime.Parse(CommonBLL.GetFieldValue(fields, "END_TIME"));

            ///
            beginTime = DateTime.Parse(date.ToString("yyyy-MM-dd") + " " + beginTime.ToString("HH:mm"));
            endTime   = DateTime.Parse(date.ToString("yyyy-MM-dd") + " " + endTime.ToString("HH:mm"));
            //还需校验相同维度下开始时间+结束时间为时间范围,各条数据之间时间范围不能交叉,
            //例如相同工厂代码①、车间代码②、产线代码③下已维护了2018-03-17 08:00:00至 2018-03-17 16:00:00的数据,
            //再维护2018-03-17 15:00:00至 2018-03-18 06:00:00的数据保存时需要报错
            if (beginTime >= endTime)
            {
                endTime = endTime.AddDays(1);
            }
            int cnt = dal.GetCounts(string.Format(@"and [PLANT] = N'{0}' and [WORKSHOP] = N'{1}' and [ASSEMBLY_LINE] = N'{2}' "
                                                  + "and (([BEGIN_TIME]< N'{3}' and [END_TIME] > N'{3}') or ([END_TIME] > N'{4}' and [BEGIN_TIME] < N'{4}') or ([BEGIN_TIME] > N'{3}' and [BEGIN_TIME] < N'{4}') or ([END_TIME] > N'{3}' and [END_TIME] < N'{4}')) and [ID] <>{5}"
                                                  , plant, workshop, assemblyLine, beginTime, endTime, id));

            if (cnt > 0)
            {
                throw new Exception("Err_:MC:0x00000199");
            }
            ///
            fields = CommonBLL.SetFieldValue(fields, "BEGIN_TIME", beginTime.ToString("yyyy-MM-dd HH:mm:ss"));
            fields = CommonBLL.SetFieldValue(fields, "END_TIME", endTime.ToString("yyyy-MM-dd HH:mm:ss"));
            return(dal.UpdateInfo(fields, id) > 0 ? true : false);
        }
Пример #3
0
        /// <summary>
        /// UpdateInfo
        /// </summary>
        /// <param name="fields"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool UpdateInfo(string fields, long id)
        {
            TwdWindowTimeInfo info = dal.GetInfo(id);

            if (info == null)
            {
                throw new Exception("MC:0x00000084");///数据错误
            }
            if (info.SendTimeStatus.GetValueOrDefault() != (int)SendTimeStatusConstants.NoSend)
            {
                throw new Exception("MC:0x00000311");///发单状态为未发单才允许被修改
            }
            string partBoxCode = CommonBLL.GetFieldValue(fields, "PART_BOX_CODE");
            string workDay     = CommonBLL.GetFieldValue(fields, "WORK_DAY");
            string windowTime  = CommonBLL.GetFieldValue(fields, "WINDOW_TIME");
            ///窗口时间
            DateTime dateWindowTime = CommonBLL.TryParseDatetime(windowTime, "yyyy-MM-dd HH:mm:ss");
            DateTime dateWorkDay    = CommonBLL.TryParseDatetime(workDay, "yyyy-MM-dd HH:mm:ss");

            dateWindowTime = new DateTime(dateWorkDay.Year, dateWorkDay.Month, dateWorkDay.Day, dateWindowTime.Hour, dateWindowTime.Minute, 0);
            int cnt = dal.GetCounts("[PART_BOX_CODE] = N'" + info.PartBoxCode + "' and [WINDOW_TIME] = N'" + info.WindowTime.GetValueOrDefault() + "' and [ID] <> " + id + "");

            if (cnt > 0)
            {
                throw new Exception("MC:0x00000313");///相同零件类代码②、工作日⑧、窗口时间⑩的数据不允许重复
            }
            fields = CommonBLL.SetFieldValue(fields, "WINDOW_TIME", dateWindowTime.ToString("yyyy-MM-dd HH:mm:ss"));

            TwdPartBoxInfo twdPartBoxInfo = new TwdPartBoxDAL().GetInfo(partBoxCode);

            if (twdPartBoxInfo == null)
            {
                throw new Exception("MC:0x00000225");///拉动零件类数据错误
            }
            ///发单时间 = 工作日年月日 + 窗口时间时分秒 - 提前时间
            int advanceTime = twdPartBoxInfo.RequirementAccumulateTime.GetValueOrDefault() + ///累积时间
                              twdPartBoxInfo.LoadTime.GetValueOrDefault() +                  ///装货时间
                              twdPartBoxInfo.TransportTime.GetValueOrDefault() +             ///运输时间
                              twdPartBoxInfo.UnloadTime.GetValueOrDefault();                 ///卸货时间
            DateTime sendTime = dateWindowTime.AddMinutes(0 - advanceTime);

            fields = CommonBLL.SetFieldValue(fields, "SEND_TIME", sendTime.ToString("yyyy-MM-dd HH:mm:ss"));

            return(dal.UpdateInfo(fields, id) > 0 ? true : false);
        }
        /// <summary>
        /// UpdateInfo
        /// </summary>
        /// <param name="fields"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool UpdateInfo(string fields, long id)
        {
            string receiveNo = CommonBLL.GetFieldValue(fields, "RECEIVE_NO");

            if (!string.IsNullOrEmpty(receiveNo))
            {
                fields = CommonBLL.SetFieldValue(fields, "RECEIVE_NO", receiveNo.Split(',')[0]);
            }
            string outputNo = CommonBLL.GetFieldValue(fields, "OUTPUT_NO");

            if (!string.IsNullOrEmpty(outputNo))
            {
                fields = CommonBLL.SetFieldValue(fields, "OUTPUT_NO", outputNo.Split(',')[0]);
            }
            string runsheetNo = CommonBLL.GetFieldValue(fields, "RUNSHEET_NO");

            if (!string.IsNullOrEmpty(runsheetNo))
            {
                fields = CommonBLL.SetFieldValue(fields, "RUNSHEET_NO", runsheetNo.Split(',')[0]);
            }

            return(dal.UpdateInfo(fields, id) > 0 ? true : false);
        }
        /// <summary>
        /// 验证和修改数据
        /// </summary>
        /// <param name="fields"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool UpdateInfo(string fields, long id)
        {
            int cnt = 0;
            ///供应商简称②不允许重复
            string supplierSname = CommonBLL.GetFieldValue(fields, "SUPPLIER_SNAME");

            if (!string.IsNullOrEmpty(supplierSname))
            {
                cnt = dal.GetCounts("[SUPPLIER_SNAME] = N'" + supplierSname + "'and [ID] <>" + id + "");
                if (cnt > 0)
                {
                    throw new Exception("MC:0x00000692");  ///供应商简称不能重复
                }
            }
            ///邓白氏码②不能重复
            string duns = CommonBLL.GetFieldValue(fields, "DUNS");

            if (!string.IsNullOrEmpty(duns))
            {
                cnt = dal.GetCounts("[DUNS] = N'" + duns + "'and [ID] <> " + id + "");
                if (cnt > 0)
                {
                    throw new Exception("MC:0x00000690");///邓白氏码不能重复
                }
            }

            ///TODO:需要测试一下在配置了这个字段时,但是不填写的情况会是什么样的反馈
            string supplierType = CommonBLL.GetFieldValue(fields, "SUPPLIER_TYPE");

            ///未选中供应商类型则默认为物料供应商
            if (supplierType == "0" || string.IsNullOrEmpty(supplierType))
            {
                fields = CommonBLL.SetFieldValue(fields, "SUPPLIER_TYPE", "10", false);
            }

            return(dal.UpdateInfo(fields, id) > 0 ? true : false);
        }
Пример #6
0
        /// <summary>
        /// UpdateInfo
        /// </summary>
        /// <param name="fields"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool UpdateInfo(string fields, long id)
        {
            string      receiveFid  = CommonBLL.GetFieldValue(fields, "RECEIVE_FID");
            ReceiveInfo receiveInfo = new ReceiveDAL().GetInfo(Guid.Parse(receiveFid));

            if (receiveInfo == null)
            {
                throw new Exception("MC:0x00000252");///入库单数据错误
            }
            //if (receiveInfo.Status == (int)WmmOrderStatusConstants.Completed
            //    || receiveInfo.Status == (int)WmmOrderStatusConstants.Closed)
            //    throw new Exception("MC:0x00000253");///入库单状态为已关闭或已完成时不能修改其内容

            //if (receiveInfo.Status == (int)WmmOrderStatusConstants.Created)
            //{
            //    ///入库单是否按供应商类型校验
            //    string receiveOrderValidSupplierTypeFlag = new ConfigDAL().GetValueByCode("RECEIVE_ORDER_VALID_SUPPLIER_TYPE_FLAG");
            //    if (receiveOrderValidSupplierTypeFlag.ToLower() == "true")
            //    {
            //        string supplierNum = CommonBLL.GetFieldValue(fields, "SUPPLIER_NUM");
            //        string partNo = CommonBLL.GetFieldValue(fields, "PART_NO");
            //        ///需要校验入库单的供应商是否为储运供应商
            //        int cnt = new SupplierDAL().GetCounts("[SUPPLIER_TYPE] = " + (int)SupplierTypeConstants.LogisticsSupplier + " and [SUPPLIER_NUM] in (select [SUPPLIER_NUM] from [LES].[TT_WMM_RECEIVE] with(nolock) where [FID] = N'" + receiveFid + "' and [VALID_FLAG] = 1)");

            //        ///储运供应商标记
            //        bool logisticsSupplierFlag = cnt == 0 ? false : true;
            //        if (logisticsSupplierFlag)
            //        {
            //            cnt = dal.GetCounts("[ID] <> " + id + " and [PART_NO] = N'" + partNo + "' and [SUPPLIER_NUM] = N'" + supplierNum + "' and [RECEIVE_FID] = N'" + receiveFid + "'");
            //            if (cnt > 0)
            //                throw new Exception("MC:0x00000175");///同一入库单下不能出现相同供应商的物料编码
            //        }
            //        else
            //        {
            //            ///入库单明细与入库单不是同一家供应商
            //            cnt = new ReceiveDAL().GetCounts("[SUPPLIER_NUM] = N'" + supplierNum + "' and [FID] = N'" + receiveFid + "'");
            //            if (cnt == 0)
            //                throw new Exception("MC:0x00000176");///入库单的物料供应商与入库明细的供应商不一致

            //            cnt = dal.GetCounts("[ID] <> " + id + " and [PART_NO] = N'" + partNo + "' and [RECEIVE_FID] = N'" + receiveFid + "'");
            //            if (cnt > 0)
            //                throw new Exception("MC:0x00000177");///同一入库单下不能出现相同的物料编码
            //        }
            //    }
            //}
            //else
            //{
            ReceiveDetailInfo receiveDetailInfo = dal.GetInfo(id);

            ///实收数量
            string actualQty = CommonBLL.GetFieldValue(fields, "ACTUAL_QTY");

            if (string.IsNullOrEmpty(actualQty))
            {
                actualQty = "NULL";
            }
            if (Convert.ToInt32(actualQty) > receiveDetailInfo.RequiredQty)
            {
                throw new Exception("MC:0x00000424");    ///实收数不能大于需求数
            }
            ///实收箱数
            string actualBoxNum = CommonBLL.GetFieldValue(fields, "ACTUAL_BOX_NUM");

            if (string.IsNullOrEmpty(actualBoxNum))
            {
                actualBoxNum = "NULL";
            }
            ///修改用户
            string loginUser = CommonBLL.GetFieldValue(fields, "MODIFY_USER");

            fields = "[ACTUAL_QTY] = " + actualQty + ",[ACTUAL_BOX_NUM] = " + actualBoxNum + ",[MODIFY_DATE] = GETDATE(),[MODIFY_USER] = N'" + loginUser + "' ";
            // }

            string requiredBoxNum = CommonBLL.GetFieldValue(fields, "REQUIRED_BOX_NUM");

            int.TryParse(requiredBoxNum, out int intRequiredBoxNum);
            ///如果需求箱数大于零
            if (intRequiredBoxNum > 0)
            {
                string perpackageGrossWeight = CommonBLL.GetFieldValue(fields, "PERPACKAGE_GROSS_WEIGHT");
                decimal.TryParse(perpackageGrossWeight, out decimal decimalPerpackageGrossWeight);
                string sumWeight = CommonBLL.GetFieldValue(fields, "SUM_WEIGHT");
                decimal.TryParse(sumWeight, out decimal decimalSumWeight);
                ///如果未填写单包装毛重,但是填写了总毛重,需要计算
                if (decimalPerpackageGrossWeight == 0 && decimalSumWeight > 0)
                {
                    decimalPerpackageGrossWeight = decimalSumWeight / intRequiredBoxNum;
                    fields = CommonBLL.SetFieldValue(fields, "PERPACKAGE_GROSS_WEIGHT", decimalPerpackageGrossWeight.ToString(), false);
                }

                string packageVolume = CommonBLL.GetFieldValue(fields, "PACKAGE_VOLUME");
                decimal.TryParse(packageVolume, out decimal decimalPackageVolume);
                string sumVolume = CommonBLL.GetFieldValue(fields, "SUM_VOLUME");
                decimal.TryParse(sumVolume, out decimal decimalSumVolume);
                ///体积也是如此处理
                if (decimalPackageVolume == 0 && decimalSumVolume > 0)
                {
                    decimalPackageVolume = decimalSumVolume / intRequiredBoxNum;
                    fields = CommonBLL.SetFieldValue(fields, "PACKAGE_VOLUME", decimalPackageVolume.ToString(), false);
                }

                string package = CommonBLL.GetFieldValue(fields, "PACKAGE");
                decimal.TryParse(package, out decimal decimalPackage);
                string requiredQty = CommonBLL.GetFieldValue(fields, "REQUIRED_QTY");
                decimal.TryParse(requiredQty, out decimal decimalRequiredQty);
                ///件数也是如此处理
                if (decimalPackage == 0 && decimalRequiredQty > 0)
                {
                    decimalPackage = Math.Ceiling(decimalRequiredQty / intRequiredBoxNum);
                    fields         = CommonBLL.SetFieldValue(fields, "PACKAGE", decimalPackage.ToString(), false);
                }
            }

            return(dal.UpdateInfo(fields, id) > 0 ? true : false);
        }
        /// <summary>
        /// UpdateInfo
        /// </summary>
        /// <param name="fields"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool UpdateInfo(string fields, long id)
        {
            VmiOutputDetailInfo vmiOutputDetailInfo = dal.GetInfo(id);

            if (vmiOutputDetailInfo == null)
            {
                throw new Exception("MC:0x00000084");///数据错误
            }
            VmiOutputInfo vmiOutputInfo = new VmiOutputDAL().GetInfo(vmiOutputDetailInfo.OutputFid.GetValueOrDefault());

            if (vmiOutputInfo == null)
            {
                throw new Exception("MC:0x00000084");///出库单数据错误
            }
            if (vmiOutputInfo.Status == (int)WmmOrderStatusConstants.Completed ||
                vmiOutputInfo.Status == (int)WmmOrderStatusConstants.Closed)
            {
                throw new Exception("MC:0x00000412");///出库单状态为已关闭或已完成时不能修改其内容
            }
            ///修改用户
            string loginUser = CommonBLL.GetFieldValue(fields, "MODIFY_USER");

            if (vmiOutputInfo.Status == (int)WmmOrderStatusConstants.Published)
            {
                ///实收数量
                string actualQty = CommonBLL.GetFieldValue(fields, "ACTUAL_QTY");
                if (string.IsNullOrEmpty(actualQty))
                {
                    actualQty = "NULL";
                }
                if (Convert.ToDecimal(actualQty) > vmiOutputDetailInfo.RequiredQty.GetValueOrDefault())
                {
                    throw new Exception("MC:0x00000424");///实收数不能大于需求数
                }
                ///实收箱数
                string actualBoxNum = CommonBLL.GetFieldValue(fields, "ACTUAL_BOX_NUM");
                if (string.IsNullOrEmpty(actualBoxNum))
                {
                    actualBoxNum = "NULL";
                }

                fields = "[ACTUAL_QTY] = " + actualQty + ",[ACTUAL_BOX_NUM] = " + actualBoxNum + ",[MODIFY_DATE] = GETDATE(),[MODIFY_USER] = N'" + loginUser + "' ";
                ///
                return(dal.UpdateInfo(fields, id) > 0 ? true : false);
            }
            ///
            string partNo      = CommonBLL.GetFieldValue(fields, "PART_NO");
            string supplierNum = CommonBLL.GetFieldValue(fields, "SUPPLIER_NUM");

            ///
            if (dal.GetList("[OUTPUT_FID] = N'" + vmiOutputInfo.Fid.GetValueOrDefault() + "' and " +
                            "[PART_NO] = N'" + partNo + "' and " +
                            "[SUPPLIER_NUM] = N'" + supplierNum + "' and " +
                            "[ID] <> " + id + "", string.Empty).Count > 0)
            {
                throw new Exception("MC:0x00000464");///同物料号供应商不能一致
            }
            ///实收数量
            string requiredQty = CommonBLL.GetFieldValue(fields, "REQUIRED_QTY");

            if (string.IsNullOrEmpty(requiredQty))
            {
                requiredQty = "0";
            }
            if (Convert.ToDecimal(requiredQty) <= 0)
            {
                throw new Exception("MC:0x00000507");///物料需求数量不能小于等于零
            }
            ///创建VMI出库单时实发数量等于需求数量
            string create_vmi_output_actual_qty_equals_required = new ConfigDAL().GetValueByCode("CREATE_VMI_OUTPUT_ACTUAL_QTY_EQUALS_REQUIRED");
            ///实收数量
            string package = CommonBLL.GetFieldValue(fields, "PACKAGE");

            if (string.IsNullOrEmpty(package))
            {
                package = "0";
            }
            ///有单包装数量时需要计算
            if (Convert.ToDecimal(package) > 0)
            {
                int requiredBoxNum = Convert.ToInt32(Math.Ceiling(Convert.ToDecimal(requiredQty) / Convert.ToDecimal(package)));
                fields = CommonBLL.SetFieldValue(fields, "REQUIRED_BOX_NUM", requiredBoxNum.ToString(), false);
                if (!string.IsNullOrEmpty(create_vmi_output_actual_qty_equals_required) && create_vmi_output_actual_qty_equals_required.ToLower() == "true")
                {
                    fields = CommonBLL.SetFieldValue(fields, "ACTUAL_BOX_NUM", requiredBoxNum.ToString(), false);
                }
            }
            if (!string.IsNullOrEmpty(create_vmi_output_actual_qty_equals_required) && create_vmi_output_actual_qty_equals_required.ToLower() == "true")
            {
                fields = CommonBLL.SetFieldValue(fields, "ACTUAL_QTY", requiredQty.ToString(), false);
            }

            return(dal.UpdateInfo(fields, id) > 0 ? true : false);
        }
        /// <summary>
        /// UpdateInfo
        /// </summary>
        /// <param name="fields"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool UpdateInfo(string fields, long id)
        {
            VmiReceiveDetailInfo vmiReceiveDetailInfo = dal.GetInfo(id);

            if (vmiReceiveDetailInfo == null)
            {
                throw new Exception("MC:0x00000084");///数据错误
            }
            VmiReceiveInfo receiveInfo = new VmiReceiveDAL().GetInfo(vmiReceiveDetailInfo.ReceiveFid.GetValueOrDefault());

            if (receiveInfo == null)
            {
                throw new Exception("MC:0x00000252");///入库单数据错误
            }
            if (receiveInfo.Status.GetValueOrDefault() == (int)WmmOrderStatusConstants.Completed || receiveInfo.Status.GetValueOrDefault() == (int)WmmOrderStatusConstants.Closed)
            {
                throw new Exception("MC:0x00000253");///入库单状态为已关闭或已完成时不能修改其内容
            }
            ///实收数量
            string actualQty = CommonBLL.GetFieldValue(fields, "ACTUAL_QTY");
            ///VMI入库单明细校验实收数量小于等于需求数量
            string vmi_receive_detail_valid_actual_qty_less_required = new ConfigDAL().GetValueByCode("VMI_RECEIVE_DETAIL_VALID_ACTUAL_QTY_LESS_EQUAL_REQUIRED");

            if (!string.IsNullOrEmpty(vmi_receive_detail_valid_actual_qty_less_required) && vmi_receive_detail_valid_actual_qty_less_required.ToLower() == "true")
            {
                decimal.TryParse(actualQty, out decimal dActualQty);
                if (dActualQty > vmiReceiveDetailInfo.RequiredQty.GetValueOrDefault())
                {
                    throw new Exception("MC:0x00000490");///物料实收数量不允许大于需求数量
                }
            }
            ///如果入库状态为已发布,则只能更新实收数量和实收箱数
            if (receiveInfo.Status.GetValueOrDefault() == (int)WmmOrderStatusConstants.Published)
            {
                if (string.IsNullOrEmpty(actualQty))
                {
                    actualQty = "NULL";
                }
                ///实收箱数
                string actualBoxNum = CommonBLL.GetFieldValue(fields, "ACTUAL_BOX_NUM");
                if (string.IsNullOrEmpty(actualBoxNum))
                {
                    actualBoxNum = "NULL";
                }
                ///修改用户
                string loginUser = CommonBLL.GetFieldValue(fields, "MODIFY_USER");
                fields = "[ACTUAL_QTY] = " + actualQty + ",[ACTUAL_BOX_NUM] = " + actualBoxNum + ",[MODIFY_DATE] = GETDATE(),[MODIFY_USER] = N'" + loginUser + "' ";
                return(dal.UpdateInfo(fields, id) > 0 ? true : false);
            }

            string requiredBoxNum = CommonBLL.GetFieldValue(fields, "REQUIRED_BOX_NUM");

            int.TryParse(requiredBoxNum, out int intRequiredBoxNum);
            ///如果需求箱数大于零
            if (intRequiredBoxNum > 0)
            {
                string perpackageGrossWeight = CommonBLL.GetFieldValue(fields, "PERPACKAGE_GROSS_WEIGHT");
                decimal.TryParse(perpackageGrossWeight, out decimal decimalPerpackageGrossWeight);
                string sumWeight = CommonBLL.GetFieldValue(fields, "SUM_WEIGHT");
                decimal.TryParse(sumWeight, out decimal decimalSumWeight);
                ///如果未填写单包装毛重,但是填写了总毛重,需要计算
                if (decimalPerpackageGrossWeight == 0 && decimalSumWeight > 0)
                {
                    decimalPerpackageGrossWeight = decimalSumWeight / intRequiredBoxNum;
                    fields = CommonBLL.SetFieldValue(fields, "PERPACKAGE_GROSS_WEIGHT", decimalPerpackageGrossWeight.ToString(), false);
                }

                string packageVolume = CommonBLL.GetFieldValue(fields, "PACKAGE_VOLUME");
                decimal.TryParse(packageVolume, out decimal decimalPackageVolume);
                string sumVolume = CommonBLL.GetFieldValue(fields, "SUM_VOLUME");
                decimal.TryParse(sumVolume, out decimal decimalSumVolume);
                ///体积也是如此处理
                if (decimalPackageVolume == 0 && decimalSumVolume > 0)
                {
                    decimalPackageVolume = decimalSumVolume / intRequiredBoxNum;
                    fields = CommonBLL.SetFieldValue(fields, "PACKAGE_VOLUME", decimalPackageVolume.ToString(), false);
                }

                string package = CommonBLL.GetFieldValue(fields, "PACKAGE");
                decimal.TryParse(package, out decimal decimalPackage);
                string requiredQty = CommonBLL.GetFieldValue(fields, "REQUIRED_QTY");
                decimal.TryParse(requiredQty, out decimal decimalRequiredQty);
                ///件数也是如此处理
                if (decimalPackage == 0 && decimalRequiredQty > 0)
                {
                    decimalPackage = Math.Ceiling(decimalRequiredQty / intRequiredBoxNum);
                    fields         = CommonBLL.SetFieldValue(fields, "PACKAGE", decimalPackage.ToString(), false);
                }
            }

            return(dal.UpdateInfo(fields, id) > 0 ? true : false);
        }