Ejemplo n.º 1
0
        public bool SaveQualityDetailInfo(DeliveryReceive_Model DeliveryModel, UserInfo userModel, ref string strErrMsg)
        {
            try
            {
                if (DeliveryModel.lstDeliveryDetail == null || DeliveryModel.lstDeliveryDetail.Count == 0)
                {
                    strErrMsg = "没有质检数据!";
                    return(false);
                }

                if (DeliveryModel.lstDeliveryDetail.Where(t => t.OKSelect == true).Count() == 0)
                {
                    strErrMsg = "请选中质检行!";
                    return(false);
                }

                if (DeliveryModel.lstDeliveryDetail.Where(t => t.CurrentQualityQty > 0 || t.CurrentUnQualityQty > 0).Count() == 0)
                {
                    strErrMsg = "合格数量和不合格数量都为零,不能保存!";
                    return(false);
                }

                if (CheckQualityQty(DeliveryModel.lstDeliveryDetail.Where(t => t.CurrentQualityQty > 0 || t.CurrentUnQualityQty > 0).ToList(), ref strErrMsg) == false)
                {
                    return(false);
                }
                DeliveryModel.lstDeliveryDetail = DeliveryModel.lstDeliveryDetail.Where(t => t.OKSelect == true).ToList();
                string strDeliveryDetailXml = XMLUtil.XmlUtil.Serializer(typeof(DeliveryReceive_Model), DeliveryModel);
                TOOL.WriteLogMethod.WriteLog("方法:SaveQualityDetailInfo" + strDeliveryDetailXml);
                ReceiveGoods_DB RGD = new ReceiveGoods_DB();

                return(RGD.SaveQualityDetailInfo(strDeliveryDetailXml, userModel, ref strErrMsg));
            }
            catch (Exception ex)
            {
                strErrMsg = ex.Message;
                return(false);
            }
        }