예제 #1
0
        public string PostStorage(dynamic data)
        {
            string msg      = "";
            string BillCode = data["BillCode"];
            var    result   = new QMS_ProcessInspectionItemService().AuditBillCode(data["BillCode"].ToString(), out msg);
            //生成物料条码:自制件
            var QMS_ProcessInspectionModel = new QMS_ProcessInspectionService().GetModel(ParamQuery.Instance().AndWhere("BillCode", BillCode));

            if (QMS_ProcessInspectionModel != null)
            {
                string InnerFactoryBatch = QMS_ProcessInspectionModel.BatchCode;         //厂内批次
                string OuterFactoryBatch = QMS_ProcessInspectionModel.OuterFactoryBatch; //厂外批次

                string PartCode       = QMS_ProcessInspectionModel.PartCode;
                string PartName       = QMS_ProcessInspectionModel.PartName;
                string PartFigureCode = QMS_ProcessInspectionModel.partFigure;

                string ContractCode = QMS_ProcessInspectionModel.ContractCode;
                string ProductName  = QMS_ProcessInspectionModel.ProductName;
                int    ProductID    = new PMS_BN_ProjectDetailService().GetModel(ParamQuery.Instance().AndWhere("ProductName", ProductName)).ID;

                var ProcessBomModel = new PRS_Process_BOMService().GetModel(ParamQuery.Instance().AndWhere("PartCode", PartCode));
                if (ProcessBomModel != null)
                {
                    string InventoryCode = ProcessBomModel.InventoryCode; //存货编码
                    string InventoryName = ProcessBomModel.InventoryName; //存货名称

                    var SYS_MaterialBatchModel = new SYS_MaterialBatchService().GetModel(ParamQuery.Instance()
                                                                                         .AndWhere("PartCode", PartCode)
                                                                                         .AndWhere("InnerFactoryBatch", InnerFactoryBatch)
                                                                                         .AndWhere("OuterFactoryBatch", OuterFactoryBatch));

                    if (SYS_MaterialBatchModel == null)
                    {
                        var    model       = new SYS_MaterialBatchService();
                        string MateBarCode = model.CreateMateBarCode(700000000000);
                        model.Insert(ParamInsert.Instance()
                                     .Insert("SYS_MaterialBatch")
                                     .Column("MateBarCode", MateBarCode)
                                     .Column("InventoryCode", InventoryCode)
                                     .Column("InventoryName", InventoryName)
                                     .Column("PartCode", PartCode)
                                     .Column("PartFigureCode", PartFigureCode)
                                     .Column("PartName", PartName)
                                     .Column("InnerFactoryBatch", InnerFactoryBatch)
                                     .Column("OuterFactoryBatch", OuterFactoryBatch)
                                     .Column("ContractCode", ContractCode)
                                     .Column("ProductID", ProductID));
                    }
                }
            }
            return(msg);
        }
예제 #2
0
        public string PostStorage(dynamic data)
        {
            string msg      = "";
            string BillCode = data["BillCode"];
            var    result   = new QMS_GoodsInspectionItemService().AuditBillCode(BillCode, out msg);
            //生成物料条码:外购件
            var QMS_GoodsCheckModel = new QMS_GoodsCheckService().GetModel(ParamQuery.Instance().AndWhere("BillCode", BillCode));

            if (QMS_GoodsCheckModel != null)
            {
                string InnerFactoryBatch = QMS_GoodsCheckModel.BatchCode;         //厂内批次
                string OuterFactoryBatch = QMS_GoodsCheckModel.OuterFactoryBatch; //厂外批次
                string InventoryCode     = QMS_GoodsCheckModel.InventoryCode;     //存货编码
                var    SysPartModel      = new SYS_PartService().GetModel(ParamQuery.Instance().AndWhere("InventoryCode", InventoryCode));
                if (SysPartModel != null)
                {
                    string InventoryName  = SysPartModel.InventoryName;
                    string PartCode       = SysPartModel.PartCode;
                    string PartName       = SysPartModel.PartName;
                    string PartFigureCode = SysPartModel.FigureCode;
                    //string CorrespondingBarcode = SysPartModel.CorrespondingBarcode; //无用字段

                    var SYS_MaterialBatchModel = new SYS_MaterialBatchService().GetModel(ParamQuery.Instance()
                                                                                         .AndWhere("PartCode", PartCode)
                                                                                         .AndWhere("InnerFactoryBatch", InnerFactoryBatch)
                                                                                         .AndWhere("OuterFactoryBatch", OuterFactoryBatch));

                    if (SYS_MaterialBatchModel == null)
                    {
                        var    model       = new SYS_MaterialBatchService();
                        string MateBarCode = model.CreateMateBarCode(0);
                        model.Insert(ParamInsert.Instance()
                                     .Insert("SYS_MaterialBatch")
                                     .Column("MateBarCode", MateBarCode)
                                     .Column("InventoryCode", InventoryCode)
                                     .Column("InventoryName", InventoryName)
                                     .Column("PartCode", PartCode)
                                     .Column("PartFigureCode", PartFigureCode)
                                     .Column("PartName", PartName)
                                     .Column("InnerFactoryBatch", InnerFactoryBatch)
                                     .Column("OuterFactoryBatch", OuterFactoryBatch));
                    }
                }
            }
            return(msg);
        }