Пример #1
0
        public bool UpdateInfo(string fields, long id)
        {
            PackageInboundDetailInfo info = dal.GetInfo(id);

            if (info == null)
            {
                throw new Exception("MC:0x00000084");///数据有误
            }
            List <PackageInboundInfo> inboundInfo = new PackageInboundDAL().GetList(" [FID] = N'" + info.OrderFid + "'", string.Empty);

            if (inboundInfo == null)
            {
                throw new Exception("MC:0x00000084");///数据有误
            }
            if (inboundInfo.FirstOrDefault().Status != (int)PackageInboundStatusConstants.Created)
            {
                throw new Exception("MC:0x00000441");///状态为10.已创建时可以进行修改或删除
            }
            return(dal.UpdateInfo(fields, id) > 0 ? true : false);
        }
Пример #2
0
        public long InsertInfo(PackageInboundDetailInfo info)
        {
            int Cnt = dal.GetCounts(" and [PACKAGE_MODEL] = N'" + info.PackageModel + "' and [PACKAGE_STATUS] = '" + info.PackageStatus + "'");

            if (Cnt > 0)
            {
                throw new Exception("MC:0x00000487");///包装型号⑨+状态⑪相同的数据不允许重复添加
            }
            Cnt = new PackageInboundDAL().GetList("[FID] = N'" + info.OrderFid + "' and [STATUS] <> " + (int)PackageInboundStatusConstants.Created, string.Empty).Count();
            if (Cnt > 0)
            {
                throw new Exception("MC:0x00000488");///已创建状态才可进行物料添加
            }
            PackageInboundInfo package = new PackageInboundDAL().GetList("[FID] = N'" + info.OrderFid + "'", string.Empty).FirstOrDefault();

            info.SWmNo       = package.SWmNo;
            info.SZoneNo     = package.SZoneNo;
            info.TWmNo       = package.TWmNo;
            info.TZoneNo     = package.TZoneNo;
            info.SupplierNum = package.SupplierNum;
            return(dal.Add(info));
        }