コード例 #1
0
        public int PostOnSave(List <PMS_BN_Project> model)
        {
            List <string> strList = new PMS_BN_ProjectService().GetCnotractCode();

            if (model.Count < 0)
            {
                return(0);
            }
            else
            {
                int result = 0;
                if (model[0].ProjectID <= 0)
                {
                    //if (model[0].ContractCode)
                    bool isContain = strList.Contains(model[0].ContractCode);
                    if (!isContain)
                    {
                        model[0].CreateTime   = DateTime.Now;
                        model[0].ModifyTime   = model[0].CreateTime;
                        model[0].CreatePerson = MmsHelper.GetUserCode();
                        model[0].ModifyPerson = model[0].CreatePerson;
                        result = new PMS_BN_ProjectService().Insert(model[0]);
                    }
                    else
                    {
                        MmsHelper.ThrowHttpExceptionWhen(false, "合同编号重复,请确认数据!", 0);
                    }
                }
                else
                {
                    result = new PMS_BN_ProjectService().Update(model[0]);
                }
                return(result);
            }
        }
コード例 #2
0
        public dynamic PostProjectDetailOnSave(List <PMS_BN_ProjectDetail> model)
        {
            int result = 0;

            if (model.Count > 0)
            {
                if (model[0].ID <= 0)
                {
                    model[0].CreateTime   = DateTime.Now;
                    model[0].ModifyTime   = model[0].CreateTime;
                    model[0].CreatePerson = MmsHelper.GetUserCode();
                    model[0].ModifyPerson = model[0].CreatePerson;
                    result = new PMS_BN_ProjectDetailService().Insert(model[0]);
                }
                else
                {
                    result = new PMS_BN_ProjectDetailService().Update(model[0]);
                }
            }

            return(new
            {
                result = result
            });
        }
コード例 #3
0
        public dynamic PostProductionTaskDetailOnSave(List <PMS_ProductPlanDetail> model)
        {
            int result = 0;

            if (model.Count > 0)
            {
                if (model[0].ID <= 0)
                {
                    model[0].ProductPlanCode = MmsHelper.GetOrderNumber("PMS_ProductPlanDetail", "ProductPlanCode", "PCSC", "", "");
                    model[0].CreateTime      = DateTime.Now;
                    model[0].ModifyTime      = model[0].CreateTime;
                    model[0].CreatePerson    = MmsHelper.GetUserCode();
                    model[0].ModifyPerson    = model[0].CreatePerson;
                    result = new PMS_ProductPlanDetailService().Insert(model[0]);
                }
                else
                {
                    result = new PMS_ProductPlanDetailService().Update(model[0]);
                }
            }

            return(new
            {
                result = result > 0
            });
        }
コード例 #4
0
        public ActionResult Index()
        {
            var code             = new sys_codeService();
            var WorkshopCodeList = new SYS_WorkGroupService()
                                   .GetModelList(ParamQuery.Instance()
                                                 .Select("DISTINCT b.DepartID")
                                                 .From("SYS_WorkGroupDetail a LEFT JOIN SYS_WorkGroup b ON a.MainID=b.ID")
                                                 .AndWhere("a.UserCode", MmsHelper.GetUserCode()));
            var WorkshopCode = "";

            var deptInfo = new SYS_BN_DepartmentService().GetDeptInfoByUCode(MmsHelper.GetUserCode());

            if (WorkshopCodeList.Count > 0)
            {
                WorkshopCode = WorkshopCodeList.FirstOrDefault().DepartID;
            }
            //ViewBag.WorkshopCode = WorkshopCode;
            ViewBag.WorkshopCode = deptInfo.DepartmentCode;
            var model = new
            {
                dataSource = new
                {
                },
                urls = new
                {
                    query  = "/api/Mms/MES_WorkingTicket",
                    newkey = "/api/Mms/MES_WorkingTicket/getnewkey",
                    edit   = "/api/Mms/MES_WorkingTicket/edit"
                },
                resx = new
                {
                    noneSelect   = "请先选择一条数据!",
                    editSuccess  = "保存成功!",
                    auditSuccess = "单据已审核!"
                },
                form = new
                {
                    WorkTicketCode = "",
                    ApsCode        = "",
                    TeamName       = "",
                    WorkshopName   = deptInfo == null?"": deptInfo.DepartmentName,
                    ProcessName    = "",
                    WorkStepsName  = "",
                    EquipmentName  = "",
                    ApproveState   = ""
                },
                defaultRow = new
                {
                    IsEnable = 1
                },
                setting = new
                {
                    idField        = "ID",
                    postListFields = new string[] { "ID", "WorkTicketCode", "TicketLevel", "ApsCode", "WorkStepsID", "IsEnable", "WorkshopCode", "WorkshopName", "TeamCode", "TeamName", "CreateTime", "CreatePerson", "ModifyTime", "ModifyPerson", "ActualStartTime", "ActualFinishTime", "ApproveState", "ApprovePerson", "ApproveTime", "ProcessCode", "ProcessName", "WorkStepsName", "WorkStepsLineCode", "WorkStepsContent", "EquipmentCode", "EquipmentName", "TurnTargetName", "TurnTargetCode", "PartCode", "WorkQuantity", "ApproveRemark" }
                }
            };

            return(View(model));
        }
コード例 #5
0
        public ActionResult Edit(string id = "")
        {
            dynamic depart = new SYS_BN_UserService().GetDepartment(MmsHelper.GetUserCode());
            string  code   = string.Empty;
            string  name   = string.Empty;

            if (depart != null)
            {
                code = depart.DepartmentCode;
                name = depart.DepartmentName;
            }
            if (string.IsNullOrEmpty(code))
            {
                return(JavaScript("请先维护所属车间!"));
            }
            var data  = new MES_WorkshopPurchaseDetailApiController().GetPageData(id);
            var model = new
            {
                urls = new
                {
                    getdata     = "/api/Mms/MES_WorkshopPurchaseDetail/GetPageData/",    //获取主表数据及数据滚动数据api
                    edit        = "/api/Mms/MES_WorkshopPurchaseDetail/edit/",           //数据保存api
                    audit       = "/api/Mms/MES_WorkshopPurchaseDetail/audit/",          //审核api
                    newkey      = "/api/Mms/MES_WorkshopPurchaseDetail/GetNewRowId/",    //获取新的明细数据的主键(日语叫采番)
                    storageSave = "/api/Mms/MES_WorkshopPurchaseDetail/PostStorage/"     //审核方法
                },
                resx = new
                {
                    rejected    = "已撤消修改!",
                    editSuccess = "保存成功!",
                    auditPassed = "单据已通过审核!",
                    auditReject = "单据已取消审核!"
                },
                dataSource = new
                {
                    pageData = data
                               //payKinds = codeService.GetValueTextListByType("PayType")
                },
                form = new
                {
                    defaults    = new MES_WorkshopPurchaseMain().Extend(new { ID = id, WorkshopPurchaseCode = data.form == null ? "系统生成" : data.form.WorkshopPurchaseCode, WorkshopID = code, WorkshopName = name, PurchaseStatus = 1, ApproveState = 1, CreateTime = "", IsEnable = 1 }),
                    primaryKeys = new string[] { "ID" }
                },
                tabs = new object[] {
                    new{
                        type       = "grid",
                        rowId      = "ID",
                        relationId = "ID",
                        postFields = new string[] { "ID", "MainID", "Model", "Spec", "Remark", "InventoryCode", "InventoryName", "MeterialName", "WriteModel", "WriteSpec", "PurchaseQuantity" },
                        defaults   = new { ID = "", MainID = id, InventoryCode = "", InventoryName = "", PurchaseQuantity = "", IsEnable = 1 }
                    }
                }
            };

            return(View(model));
        }
コード例 #6
0
        public int Insert(MES_BN_ProductProcessRoute model)
        {
            model.CreatePerson = MmsHelper.GetUserCode();
            model.CreateTime   = DateTime.Now;
            var rowsAffected = model.ID = db.Insert <MES_BN_ProductProcessRoute>("MES_BN_ProductProcessRoute", model)
                                          .AutoMap(x => x.ID)
                                          .ExecuteReturnLastId <int>();

            return(rowsAffected);
        }
コード例 #7
0
        public ActionResult Edit(string id = "")
        {
            var     data   = new SYS_WorkGroupDetailApiController().GetPageData(id);
            dynamic depart = new SYS_BN_UserService().GetDepartment(MmsHelper.GetUserCode());
            string  code   = string.Empty;
            string  name   = string.Empty;

            if (depart != null)
            {
                code = depart.DepartmentCode;
                name = depart.DepartmentName;
            }
            if (string.IsNullOrEmpty(code))
            {
                return(JavaScript("请先维护所属车间!"));
            }
            var model = new
            {
                urls = new
                {
                    getdata = "/api/Mms/SYS_WorkGroupDetail/GetPageData/",        //获取主表数据及数据滚动数据api
                    edit    = "/api/Mms/SYS_WorkGroupDetail/edit/",               //数据保存api
                    audit   = "/api/Mms/SYS_WorkGroupDetail/audit/",              //审核api
                    newkey  = "/api/Mms/SYS_WorkGroupDetail/GetNewRowId/"         //获取新的明细数据的主键(日语叫采番)
                },
                resx = new
                {
                    rejected    = "已撤消修改!",
                    editSuccess = "保存成功!",
                    auditPassed = "单据已通过审核!",
                    auditReject = "单据已取消审核!"
                },
                dataSource = new
                {
                    pageData = data,
                    //payKinds = codeService.GetValueTextListByType("PayType")
                },
                form = new
                {
                    defaults    = new SYS_WorkGroup().Extend(new { ID = id, TeamCode = data.form == null ? "系统生成" : data.form.TeamCode, TeamName = "", DepartID = code, DepartName = name, IsEnable = 1 }),
                    primaryKeys = new string[] { "ID" }
                },
                tabs = new object[] {
                    new{
                        type       = "grid",
                        rowId      = "ID",
                        relationId = "ID",
                        postFields = new string[] { "ID", "MainID", "UserCode", "UserName", "IsEnable" },
                        defaults   = new { ID = "", MainID = id, UserCode = "", UserName = "", IsEnable = "1" }
                    }
                }
            };

            return(View(model));
        }
コード例 #8
0
        public ActionResult Index()
        {
            dynamic depart = new SYS_BN_UserService().GetDepartment(MmsHelper.GetUserCode());
            string  code   = string.Empty;

            if (depart != null)
            {
                code = depart.DepartmentCode;
            }
            var model = new
            {
                dataSource = new
                {
                },
                urls = new
                {
                    query  = "/api/Mms/APS_ProjectProduceDetial",
                    newkey = "/api/Mms/APS_ProjectProduceDetial/getnewkey",
                    edit   = "/api/Mms/APS_ProjectProduceDetial/edit",
                },
                resx = new
                {
                    noneSelect   = "请先选择一条数据!",
                    editSuccess  = "保存成功!",
                    auditSuccess = "单据已审核!"
                },
                form = new
                {
                    ContractCode     = "",
                    PartCode         = "",
                    ProductName      = "",
                    WorkshopID       = code,
                    WorkshopID2      = "",
                    EquipmentID      = "",
                    WorkGroupID      = "",
                    PlanedStartTime  = "",
                    PlanedFinishTime = "",
                    PlanState        = "1",
                    ProductPlanCode  = "",
                    PlanType         = "1",
                    DesignTaskCode   = ""
                },
                defaultRow = new
                {
                },
                setting = new
                {
                    idField        = "ID",
                    postListFields = new string[] { "ID", "ContractCode", "ProjectDetailID", "ProductPlanMainID", "PartCode", "ProcessCode", "WorkshopID", "EquipmentID", "WorkGroupID", "WorkshopName", "EquipmentName", "WorkGroupName", "Quantity", "ManHour", "Unit", "EarliestStartTime", "LatestStartTime", "PlanedStartTime", "EarliestFinishTime", "LatestFinishTime", "PlanedFinishTime", "ActualStartTime", "ActualFinishTime", "FloatingHour", "PlanColor", "PlanState", "PlanType" }
                }
            };

            return(View(model));
        }
コード例 #9
0
        public void PostCreateBoard(out bool result, dynamic data)
        {
            try
            {
                string SavantCode = data.SavantCode;
                var    Item       = new PRS_BlankingResultService().GetModelList(ParamQuery.Instance().AndWhere("SavantCode", SavantCode));
                var    ItemDetail = new PRS_BlankingPlateDetailService().GetModelList(ParamQuery.Instance().AndWhere("MainID", string.Join(",", Item.Select(a => a.ID)), Cp.In));
                var    list       = from master in Item
                                    join detail in ItemDetail on master.ID equals detail.MainID
                                    select new
                {
                    MasterID            = master.ID,
                    PartBlankingQuntity = master.PartBlankingQuntity,
                    DetailID            = detail.ID,
                    PlateSize           = detail.PlateSize
                };
                new Mes_BlankingResultService()
                .Delete(ParamDelete
                        .Instance()
                        .AndWhere("BlankingResultID", string.Join(",", Item.Select(a => a.ID)), Cp.In));

                var    BoardCode   = MmsHelper.GetOrderNumber("Mes_BlankingResult", "BoardCode", "XJB", "", "");
                string PreCode     = BoardCode.Substring(0, BoardCode.Length - 3);
                int    StartNumber = Convert.ToInt32(BoardCode.Substring(BoardCode.Length - 3));

                foreach (var item in list)
                {
                    int count = item.PartBlankingQuntity;
                    for (int i = 0; i < count; i++)
                    {
                        BoardCode = PreCode + StartNumber.ToString().PadLeft(3, '0');
                        StartNumber++;
                        db.UseTransaction(true);
                        db.Insert("Mes_BlankingResult")
                        .Column("BlankingResultID", item.MasterID)
                        .Column("IsEnable", 1)
                        .Column("CreateTime", DateTime.Now)
                        .Column("CreatePerson", MmsHelper.GetUserCode())
                        .Column("BiankingSize", item.PlateSize.ToString())
                        .Column("IsBlanking", 0)
                        .Column("BlankingDetailID", item.DetailID)
                        //.Column("BlankingType",1)
                        .Column("BoardCode", BoardCode).Execute();
                    }
                }
                db.Commit();
                result = true;
            }
            catch
            {
                db.Rollback();
                result = false;
            }
        }
コード例 #10
0
        //   public int Update(PMS_ProductTask model)
        //   {
        //       var rowsAffected = db.Update<PMS_ProductTask>("PMS_ProductTask", model)
        //.AutoMap(x => x.ID)
        //.Where(x => x.ID)
        //.Execute();
        //       return rowsAffected;
        //   }
        public int SaveData(List <PMS_ProductTask> model)
        {
            int result = 0;

            if (model.Count > 0)
            {
                using (db.UseTransaction(true))
                {
                    foreach (var item in model)
                    {
                        if (item.ID <= 0)
                        {
                            //result = new PMS_ProductTaskService().Insert(item);
                            item.ProductTaskCode = MmsHelper.GetOrderNumber("PMS_ProductTask", "ProductTaskCode", "JYRW", "", "");
                            item.CreateTime      = DateTime.Now;
                            item.CreatePerson    = MmsHelper.GetUserCode();
                            item.ModifyTime      = DateTime.Now;
                            item.ModifyPerson    = MmsHelper.GetUserCode();
                            var rowsAffected = item.ID = db.Insert <PMS_ProductTask>("PMS_ProductTask", item)
                                                         .AutoMap(x => x.ID)
                                                         .ExecuteReturnLastId <int>();
                            if (rowsAffected <= 0)
                            {
                                result++;
                                db.Rollback();
                            }
                        }
                        else
                        {
                            string sql    = String.Format(@"select * from PMS_ProductTask where ID='{0}' ", item.ID);
                            var    single = db.Sql(sql).QuerySingle <PMS_ProductTask>();
                            item.CreatePerson = single.CreatePerson;
                            item.CreateTime   = single.CreateTime;
                            item.ModifyPerson = MmsHelper.GetUserCode();
                            item.ModifyTime   = DateTime.Now;
                            var rowsAffected = item.ID = db.Update <PMS_ProductTask>("PMS_ProductTask", item)
                                                         .AutoMap(x => x.ID)
                                                         .Where(x => x.ID)
                                                         .Execute();
                            if (rowsAffected <= 0)
                            {
                                result++;
                                db.Rollback();
                            }
                        }
                    }
                    if (result <= 0)
                    {
                        db.Commit();
                    }
                }
            }
            return(result);
        }
コード例 #11
0
        /// <summary>
        /// 采购接单主界面
        /// </summary>
        /// <returns></returns>

        public ActionResult Index2()
        {
            var     code       = new sys_codeService();
            dynamic depart     = new SYS_BN_UserService().GetDepartment(MmsHelper.GetUserCode());
            string  departcode = string.Empty;
            string  departname = string.Empty;

            if (depart != null)
            {
                departcode = depart.DepartmentCode;
                departname = depart.DepartmentName;
            }
            var model = new
            {
                dataSource = new
                {
                },
                urls = new
                {
                    query  = "/api/Mms/APS_ProductPurchaseDetail1",
                    newkey = "/api/Mms/APS_ProductPurchaseDetail1/getnewkey",
                    edit   = "/api/Mms/APS_ProductPurchaseDetail1/edit"
                },
                resx = new
                {
                    noneSelect   = "请先选择一条数据!",
                    editSuccess  = "保存成功!",
                    auditSuccess = "单据已审核!"
                },
                form = new
                {
                    WarehouseName  = "",
                    PurchaseDate   = "",
                    ContractCode   = "",
                    ProjectName    = "",
                    SaleMan        = MmsHelper.GetUserName(),
                    UserCode       = MmsHelper.GetUserCode(),
                    DepartmentCode = departcode
                },
                defaultRow = new
                {
                },
                setting = new
                {
                    idField        = "ID",
                    postListFields = new string[] { "ID", "MainID", "InventoryCode", "SingleProductRequestQuantity", "TotalRequestQuantity", "Remark", "PurchaseState", "IsEnable", "CreatePerson", "CreateTime", "ModifyPerson", "ModifyTime", "PurchaseQuantity", "StockQuantity", "RequestedQuantity", "SaleMan", "DepartmentCode", "DepartmentName", "WarehouseCode", "WarehouseName", "SupplierCode", "SupplierName", "OrderQuantity", "PurchaseFeedback", "PurchaseRemark", "UserCode", "PurchaseDate" }
                }
            };

            return(View(model));
        }
コード例 #12
0
        public ActionResult Index()
        {
            dynamic depart = new SYS_BN_UserService().GetDepartment(MmsHelper.GetUserCode());
            string  code   = string.Empty;
            string  name   = string.Empty;

            if (depart != null)
            {
                code = depart.DepartmentCode;
                name = depart.DepartmentName;
            }
            if (string.IsNullOrEmpty(code))
            {
                return(JavaScript("请先维护所属车间!"));
            }
            var model = new
            {
                dataSource = new
                {
                },
                urls = new
                {
                    query  = "/api/Mms/APS_ProjectProduceTemporaryTask",
                    newkey = "/api/Mms/APS_ProjectProduceTemporaryTask/getnewkey",
                    edit   = "/api/Mms/APS_ProjectProduceTemporaryTask/edit",
                    audit1 = "/api/Mms/APS_ProjectProduceTemporaryTask/GetAudit1"
                },
                resx = new
                {
                    noneSelect   = "请先选择一条数据!",
                    editSuccess  = "保存成功!",
                    auditSuccess = "单据已审核!"
                },
                form = new
                {
                    ContractCode = ""
                },
                defaultRow = new
                {
                    BillCode = "系统生成"
                },
                setting = new
                {
                    idField        = "ID",
                    postListFields = new string[] { "ID", "TemporaryTaskDec", "ContractCode", "ProjectDetailID", "ProductPlanMainID", "PartCode", "ProcessCode", "ProcessLineCode", "WorkshopID", "WorkshopName", "EquipmentID", "EquipmentName", "WorkGroupID", "WorkGroupName", "Quantity", "ManHour", "Unit", "EarliestStartTime", "LatestStartTime", "PlanedStartTime", "EarliestFinishTime", "LatestFinishTime", "PlanedFinishTime", "ActualStartTime", "ActualFinishTime", "FloatingHour", "PlanColor", "PlanState", "PlanType", "IsEnable", "CreatePerson", "CreateTime", "ModifyPerson", "ModifyTime", "ApproveState", "ApprovePerson", "ApproveDate", "ApproveRemark", "ApsCode", "BillCode" }
                }
            };

            return(View(model));
        }
コード例 #13
0
        public int Update(PMS_ProductPlanDetail model)
        {
            string sql    = String.Format(@"select * from PMS_ProductPlanDetail where ID='{0}' ", model.ID);
            var    single = db.Sql(sql).QuerySingle <PMS_ProductPlanDetail>();

            model.CreatePerson = single.CreatePerson;
            model.CreateTime   = single.CreateTime;
            model.ModifyPerson = MmsHelper.GetUserCode();
            model.ModifyTime   = DateTime.Now;
            var rowsAffected = db.Update <PMS_ProductPlanDetail>("PMS_ProductPlanDetail", model)
                               .AutoMap(x => x.ID)
                               .Where(x => x.ID)
                               .Execute();

            return(rowsAffected);
        }
コード例 #14
0
        public int Update(MES_BN_ProductProcessRoute model)
        {
            string sql    = String.Format(@"select * from MES_BN_ProductProcessRoute where id='{0}' ", model.ID);
            var    single = db.Sql(sql).QuerySingle <MES_BN_ProductProcessRoute>();

            model.CreatePerson = single.CreatePerson;
            model.CreateTime   = single.CreateTime;
            model.ModifyPerson = MmsHelper.GetUserCode();
            model.ModifyTime   = DateTime.Now;

            var rowsAffected = db.Update <MES_BN_ProductProcessRoute>("MES_BN_ProductProcessRoute", model)
                               .AutoMap(x => x.ID)
                               .Where(x => x.ID)
                               .Execute();

            return(model.ID);
        }
コード例 #15
0
        public dynamic GetPageData(string id)
        {
            //var department = new SYS_BN_UserService().GetDepartmentInfo(MmsHelper.GetUserCode());
            var warehouse = new SYS_BN_WarehouseService().GetWarehouseByCode(MmsHelper.GetUserCode());
            //if (warehouse == "0")
            //{
            //    MmsHelper.ThrowHttpExceptionWhen(true, "员工" + MmsHelper.GetUserName() + "不是仓储人员,无法进入出入库明细页面!!", 0);
            //}

            //MmsHelper.ThrowHttpExceptionWhen(warehouse == "0", "请注意,您不是仓储人员,无法进入出入库明细页面!", id);
            var masterService = new WMS_BN_BillMainService();
            var pQuery        = ParamQuery.Instance().AndWhere("ID", id);
            var mainData      = masterService.GetModel(pQuery);

            if (mainData != null)
            {
                var pQuery2 = ParamQuery.Instance().AndWhere("BillCode", mainData.BillCode);
                //mainData.WarehouseName = warehouse.WarehouseName;
                var result = new
                {
                    //主表数据
                    form       = mainData,
                    scrollKeys = masterService.ScrollKeys("ID", id),
                    //明细数据
                    tab0 = new WMS_BN_BillDetailService().GetDynamicList(pQuery2)
                };
                return(result);
            }
            else
            {
                var result = new
                {
                    //主表数据
                    form       = mainData,
                    scrollKeys = masterService.ScrollKeys("ID", id),
                    //明细数据
                    tab0 = ""
                };
                return(result);
            }
        }
コード例 #16
0
        public void Edit(dynamic data)
        {
            var listWrapper = RequestWrapper.Instance().LoadSettingXmlString(@"
    <settings>
        <table>
            APS_ProjectProduceDetial
        </table>
        <where>
            <field name='ID' cp='equal'></field>
        </where>
    </settings>");
            var service     = new APS_ProjectProduceDetialService();

            if (data.list.inserted.ToString() != "[]")
            {
                //APS明细表新增
                var    PlanCode    = MmsHelper.GetOrderNumber("APS_ProjectProduceDetial", "ApsCode", "SCJH", "", "");
                string PreCode     = PlanCode.Substring(0, PlanCode.Length - 3);
                int    StartNumber = Convert.ToInt32(PlanCode.Substring(PlanCode.Length - 3));
                foreach (dynamic row in data.list.inserted)
                {
                    var ApsCode = PreCode + StartNumber.ToString().PadLeft(3, '0');
                    row["ApsCode"] = ApsCode;
                    string MonthPlanStr  = row.MonthPlanCode;
                    var    MonthPlanList = MonthPlanStr.Split(',');
                    for (int i = 0; i < MonthPlanList.Length; i++)
                    {
                        new APS_ProduceAndMonthPlanService().Insert(
                            ParamInsert.Instance()
                            .Insert("APS_ProduceAndMonthPlan")
                            .Column("ProducePlanCode", ApsCode)
                            .Column("MonthPlanCode", MonthPlanList[i])
                            .Column("CreateTime", DateTime.Now)
                            .Column("CreatePerson", MmsHelper.GetUserCode()));
                    }
                    StartNumber++;
                }
            }
            var result = service.Edit(null, listWrapper, data);
        }
コード例 #17
0
        public ActionResult Index()
        {
            var user       = MmsHelper.GetUserCode();
            var department = new SYS_BN_UserService().GetDepartment(user);
            var model      = new
            {
                urls = new
                {
                    query  = "/api/Mms/SYS_WorkGroup",
                    remove = "/api/Mms/SYS_WorkGroup/",
                    billno = "/api/Mms/SYS_WorkGroup/getnewbillno",
                    audit  = "/api/Mms/SYS_WorkGroup/audit/",
                    edit1  = "/Mms/SYS_WorkGroup/edit/"
                },
                resx = new
                {
                    detailTitle   = "班组管理明细",
                    noneSelect    = "请先选择一条单据!",
                    deleteConfirm = "确定要删除选中的单据吗?",
                    deleteSuccess = "删除成功!",
                    auditSuccess  = "单据已审核!"
                },
                dataSource = new
                {
                    //dsPurpose = new sys_codeService().GetValueTextListByType("Purpose")
                },
                form = new
                {
                    TeamCode   = "",
                    DepartID   = department.DepartmentCode,
                    DepartName = department.DepartmentName,
                    TeamName   = ""
                },
                idField = "ID"
            };

            return(View(model));
        }
コード例 #18
0
        /// <summary>
        /// 生产管理:铸件、锻件、其他
        /// 工艺定料功能 菜单改为工艺备料功能 下料尺寸改为备料尺寸 下料数量改为备料数量
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            bool userIsProcessDept = false;

            using (var db = Db.Context("Mms"))
            {
                string sql  = string.Format(@"SELECT ID,DepartmentName,DepartmentCode FROM dbo.SYS_BN_Department WHERE IsEnable = 1 AND DepartmentCode = (SELECT DepartmentCode FROM dbo.SYS_BN_User WHERE IsEnable = 1 AND UserCode = '{0}')", MmsHelper.GetUserCode());
                var    dept = db.Sql(sql).QuerySingle <dynamic>();

                if (dept != null && dept.DepartmentName == "工艺处")
                {
                    userIsProcessDept = true;
                }
                else
                {
                    userIsProcessDept = false;
                }
            }

            ViewBag.UserIsProcessDept = userIsProcessDept;
            return(View());
        }
コード例 #19
0
        public ActionResult Edit(string id = "")
        {
            var data = new MES_MaterialReturnDetailApiController().GetPageData(id);

            var dpartment  = new SYS_BN_UserService().GetDepartmentInfo(MmsHelper.GetUserCode());
            var departid   = "";
            var departname = "";

            if (dpartment.DepartmentCode != null)
            {
                departid   = dpartment.DepartmentCode.ToString();
                departname = dpartment.DepartmentName;
            }
            string dtNow = DateTime.Now.ToString("yyyy-MM-dd");

            var model = new
            {
                urls = new
                {
                    getdata     = "/api/Mms/MES_MaterialReturnDetail/GetPageData/",    //获取主表数据及数据滚动数据api
                    edit        = "/api/Mms/MES_MaterialReturnDetail/edit/",           //数据保存api
                    audit       = "/api/Mms/MES_MaterialReturnDetail/audit/",          //审核api
                    newkey      = "/api/Mms/MES_MaterialReturnDetail/GetNewRowId/",    //获取新的明细数据的主键(日语叫采番)
                    storageSave = "/api/Mms/MES_MaterialReturnDetail/PostStorage/"
                },
                resx = new
                {
                    rejected    = "已撤消修改!",
                    editSuccess = "保存成功!",
                    auditPassed = "单据已通过审核!",
                    auditReject = "单据已取消审核!"
                },
                dataSource = new
                {
                    pageData = data
                               //payKinds = codeService.GetValueTextListByType("PayType")
                },
                form = new
                {
                    defaults = new MES_MaterialReturnMain().Extend(new
                    {
                        ID             = id,
                        BillCode       = data.form == null ? "系统生成" : data.form.BillCode,
                        PickBillCode   = "",
                        DepartmentID   = dpartment.DepartmentCode ?? "",
                        DepartmentName = dpartment.DepartmentName ?? "",
                        ReturnDate     = dtNow,
                        ContractCode   = "",
                        ProjectName    = "",
                        WarehouseCode  = "",
                        WarehouseName  = "",
                        Billstate      = 1,
                        IsEnable       = 1
                    }),
                    primaryKeys = new string[] { "ID" }
                },
                tabs = new object[] {
                    new{
                        type       = "grid",
                        rowId      = "ID",
                        relationId = "ID",

                        /*
                         * Unit VARCHAR(20) NULL
                         * Model VARCHAR(20) NULL
                         * Material VARCHAR(20) NUL
                         */
                        postFields = new string[] { "ID", "MainID", "ContractCode", "ProjectName", "InventoryCode", "InventoryName", "ReturnQuantity", "IsEnable", "Unit", "Model", "Material" },
                        defaults   = new { ID = "", MainID = id, ContractCode = "", ProjectName = "", InventoryCode = "", InventoryName = "", ReturnQuantity = "", IsEnable = 1, Unit = "", Model = "", Material = "" }
                    }
                }
            };

            return(View(model));
        }
コード例 #20
0
        public ActionResult Index()
        {
            var loginer = FormsAuth.GetUserData <LoginerBase>();
            SYS_BN_Department department = new SYS_BN_Department();

            var user = new SYS_BN_UserService().GetModel(ParamQuery.Instance().AndWhere("IsEnable", 1).AndWhere("UserCode", MmsHelper.GetUserCode()));

            department = new SYS_BN_DepartmentService().GetModel(ParamQuery.Instance().AndWhere("IsEnable", 1).AndWhere("DepartmentCode", user.DepartmentCode));

            var model = new
            {
                urls = new
                {
                    query  = "/api/Mms/MES_MaterialReturnMain",
                    remove = "/api/Mms/MES_MaterialReturnMain/",
                    billno = "/api/Mms/MES_MaterialReturnMain/getnewbillno",
                    audit  = "/api/Mms/MES_MaterialReturnMain/audit/",
                    edit1  = "/Mms/MES_MaterialReturnMain/edit/"
                },
                resx = new
                {
                    detailTitle   = "车间退料明细",
                    noneSelect    = "请先选择一条单据!",
                    deleteConfirm = "确定要删除选中的单据吗?",
                    deleteSuccess = "删除成功!",
                    auditSuccess  = "单据已审核!"
                },
                dataSource = new
                {
                    //dsPurpose = new sys_codeService().GetValueTextListByType("Purpose")
                },
                form = new
                {
                    BillCode       = "",
                    DepartmentID   = department.DepartmentCode ?? "",
                    DepartmentName = department.DepartmentName ?? ""
                },
                idField = "ID"
            };

            return(View(model));
        }
コード例 #21
0
        public int AuditBillCode(string BillCode, out string msg)
        {
            msg = string.Empty;

            var     rowsAffected = 0;
            string  sql          = String.Format(@"SELECT t1.*,
       t2.InventoryCode,
       t2.InventoryName,
       t2.RequiredQuantity,
       t2.Model,
       t2.Unit,
       t2.Material
      
FROM dbo.MES_MaterialPickMain t1
    INNER JOIN dbo.MES_MaterialPickDetail t2
        ON t1.ID = t2.MainID
           AND t1.IsEnable = 1
           AND t2.IsEnable = 1
 where t1.BillCode='{0}'", BillCode);
            string  insertSql    = "";
            dynamic MaterialPick = db.Sql(sql).QueryMany <dynamic>();

            if (MaterialPick.Count == 0)
            {
                msg = "请保存数据后审核";
                return(0);
            }
            if (MaterialPick[0].BillState == 2)
            {
                msg = "单据已审核";
                return(0);
            }
            else
            {
                using (var trans = db.UseTransaction(true))
                {
                    sql          = string.Format(@"update MES_MaterialPickMain set BillState=2 where BillCode='{0}'", BillCode);
                    rowsAffected = db.Sql(sql).Execute();
                    var dno = MmsHelper.GetOrderNumber("WMS_BN_BillMain", "BillCode", "LLCK", "", "");
                    insertSql = string.Format(@" INSERT dbo.WMS_BN_BillMain
	(
	    ID,
	    BillCode,
	    BillType,
	    ContractCode,
	    ProjectName,
	    DepartmentID,
	    DepartmentName,
	    WarehouseCode,
	    WarehouseName,
	    ApproveState,
	    Remark,
	    CreatePerson,
	    CreateTime,
	    ModifyPerson,
	    ModifyTime,
	    IsEnable,
        PickPerson,
        PickPersonCode
	)
	VALUES
	(   (select MAX(id)+1 from WMS_BN_BillMain),         -- ID - int                                         ID,
	    '{0}',        -- BillCode - varchar(50)                                                             BillCode,
	    ( SELECT Value FROM HBHC_Sys.dbo.sys_code WHERE Text='领料出库' ),                                  --BillType,
	   '{1}','{2}','{3}','{4}','{5}','{6}',1,'','{7}','{8}','{9}','{10}',1,'{11}','{12}'           
	    )"    , dno, MaterialPick[0].ContractCode, MaterialPick[0].ProjectName, MaterialPick[0].DepartmentID, MaterialPick[0].DepartmentName,
                                              MaterialPick[0].WarehouseCode, MaterialPick[0].WarehouseName, MmsHelper.GetUserName(), DateTime.Now, MmsHelper.GetUserName(), DateTime.Now, MmsHelper.GetUserName(), MmsHelper.GetUserCode());
                    foreach (var item in MaterialPick)
                    {
                        insertSql += string.Format(@"INSERT INTO dbo.WMS_BN_BillDetail
(
    BillCode,
    InventoryCode,
    InventoryName,
    Specs,
    Unit,
    MateNum,
    ConfirmNum,
    PBillCode,
    Remark,
    CreatePerson,
    CreateTime,
    ModifyPerson,
    ModifyTime,
    IsEnable
)
VALUES
(   '{0}',        -- BillCode - varchar(50)
    N'{1}',       -- InventoryCode - nvarchar(50)
    N'{2}',       -- InventoryName - nvarchar(50)
    '{3}',        -- Specs - varchar(50)
    N'{4}',       -- Unit - nvarchar(10)
    '{5}',       -- MateNum - float
    '{6}',       -- ConfirmNum - float
    '{7}',        -- PBillCode - varchar(50)
    N'',       -- Remark - nvarchar(500)
    N'{8}',       -- CreatePerson - nvarchar(50)
    GETDATE(), -- CreateTime - datetime
    N'{9}',       -- ModifyPerson - nvarchar(50)
    GETDATE(), -- ModifyTime - datetime
    1          -- IsEnable - int
    )", dno, item.InventoryCode, item.InventoryName, item.Model, item.Unit, item.RequiredQuantity,
                                                   item.RequiredQuantity, item.BillCode, MmsHelper.GetUserName(), MmsHelper.GetUserName());
                    }

                    var res = db.Sql(insertSql).Execute();
                    if (rowsAffected > 0 && res == MaterialPick.Count + 1)
                    {
                        msg = "检验记录审核成功";
                        trans.Commit();
                        return(rowsAffected);
                    }
                    else
                    {
                        trans.Rollback();
                        msg = "检验记录审核失败";
                        return(0);
                    }
                }
            }
        }
コード例 #22
0
        public int AuditBillCode(string BillCode, out string msg)
        {
            msg = string.Empty;

            var    rowsAffected = 0;
            string sql          = String.Format(@"  select ApproveState FROM MES_WorkshopPurchaseMain  where WorkshopPurchaseCode='{0}'", BillCode);
            var    state        = db.Sql(sql).QuerySingle <string>();

            if (state == "2")
            {
                msg = "单据已审核";
                return(0);
            }
            else
            {
                sql          = string.Format(@"update MES_WorkshopPurchaseMain set ApproveState='2',ApprovePerson='{1}',ApproveDate='{2}' where WorkshopPurchaseCode='{0}'", BillCode, MmsHelper.GetUserCode(), DateTime.Now);
                rowsAffected = db.Sql(sql).Execute();
                if (rowsAffected > 0)
                {
                    msg = "单据审核成功";
                    return(rowsAffected);
                }
                else
                {
                    msg = "单据审核失败";
                    return(0);
                }
            }
        }
コード例 #23
0
        public ActionResult Index(int id = 0)
        {
            var loginer = FormsAuth.GetUserData <LoginerBase>();
            SYS_BN_Department department = new SYS_BN_Department();

            if (id == 10)
            {
                var user = new SYS_BN_UserService().GetModel(ParamQuery.Instance().AndWhere("IsEnable", 1).AndWhere("UserCode", MmsHelper.GetUserCode()));
                department = new SYS_BN_DepartmentService().GetModel(ParamQuery.Instance().AndWhere("IsEnable", 1).AndWhere("DepartmentCode", user.DepartmentCode));
            }
            //var dapart=new SYS_BN_DepartmentService().get
            var warehouse = new SYS_BN_WarehouseService().GetWarehouseByCode(loginer.UserCode);

            uc         = new sys_codeService().Getsys_codeByTypeAndID("BillType", id);
            ViewBag.uc = uc;
            var model = new
            {
                urls = new
                {
                    query  = "/api/Mms/WMS_BN_BillMain",
                    remove = "/api/Mms/WMS_BN_BillMain/",
                    billno = "/api/Mms/WMS_BN_BillMain/getnewbillno",
                    audit  = "/api/Mms/WMS_BN_BillMain/audit/",
                    edit1  = "/Mms/WMS_BN_BillMain/edit/",
                    edit2  = "/Mms/WMS_BN_BillMain/customerEdit/?id=newid&type=" + id
                },
                resx = new
                {
                    detailTitle   = uc.Text + "明细",
                    noneSelect    = "请先选择一条单据!",
                    deleteConfirm = "确定要删除选中的单据吗?",
                    deleteSuccess = "删除成功!",
                    auditSuccess  = "单据已审核!"
                },
                dataSource = new
                {
                    //dsPurpose = new sys_codeService().GetValueTextListByType("Purpose")
                },
                form = new
                {
                    BillCode       = "",
                    ContractCode   = "",
                    ProjectName    = "",
                    DepartmentID   = department.DepartmentCode ?? "",
                    DepartmentName = department.DepartmentName ?? "",
                    SupplierCode   = "",
                    SupplierName   = "",
                    WarehouseCode  = "",
                    WarehouseName  = "",
                    ApproveState   = 1
                },
                idField = "ID"
            };

            return(View(model));
        }
コード例 #24
0
        public ActionResult Edit(string id = "")
        {
            var  data   = new MES_PurchaseOrderDetailApiController().GetPageData(id);
            bool isEdit = true;

            if (data.form == null)
            {
                isEdit         = false;
                ViewBag.isEdit = isEdit;
            }
            else
            {
                ViewBag.isEdit = isEdit;
            }
            var model = new
            {
                urls = new
                {
                    getdata     = "/api/Mms/MES_PurchaseOrderDetail/GetPageData/",    //获取主表数据及数据滚动数据api
                    edit        = "/api/Mms/MES_PurchaseOrderDetail/edit/",           //数据保存api
                    audit       = "/api/Mms/MES_PurchaseOrderDetail/audit/",          //审核api
                    newkey      = "/api/Mms/MES_PurchaseOrderDetail/GetNewRowId/",    //获取新的明细数据的主键(日语叫采番)
                    storageSave = "/api/Mms/MES_PurchaseOrderDetail/PostStorage/"     //审核单据
                },
                resx = new
                {
                    rejected    = "已撤消修改!",
                    editSuccess = "保存成功!",
                    auditPassed = "单据已通过审核!",
                    auditReject = "单据已取消审核!"
                },
                dataSource = new
                {
                    pageData = data
                               //payKinds = codeService.GetValueTextListByType("PayType")
                },
                form = new
                {
                    defaults    = new MES_PurchaseOrderMain().Extend(new { ID = id, BillCode = data.form == null ? "系统生成" : data.form.BillCode, ProductPurchaseCode = "", ContractCode = "", OrderDate = "", SaleMan = MmsHelper.GetUserName(), UserCode = MmsHelper.GetUserCode(), BillState = 1, IsEnable = 1 }),
                    primaryKeys = new string[] { "ID" }
                },
                tabs = new object[] {
                    new{
                        type       = "grid",
                        rowId      = "ID",
                        relationId = "ID",
                        // postFields = new string[] { "ID", "MainID", "InventoryCode", "InventoryName", "OrderQuantity", "GoodsQuantity", "IsFinish", "Model", "Unit", "UnitPrice", "TotalPrice", "IsEnable", "WarehouseID", "SupplierCode", "CheckedQuantity", "PurchaseContract" },
                        postFields = new string[] { "ID", "MainID", "InventoryCode", "InventoryName", "OrderQuantity", "GoodsQuantity", "IsFinish", "Model", "Unit", "UnitPrice", "TotalPrice", "IsEnable", "WarehouseID", "SupplierCode", "CheckedQuantity", "PlanArrivelDate", "MatchTableID" },
                        defaults   = new { ID = "", MainID = id, InventoryCode = "", OrderQuantity = "", GoodsQuantity = "", Model = "", Unit = "", UnitPrice = "", TotalPrice = "", IsFinish = 1, IsEnable = 1, SupplierCode = "", WarehouseID = "", PlanArrivelDate = "", MatchTableID = "" }
                    }
                }
            };

            return(View(model));
        }
コード例 #25
0
        public bool PostCreateWorkShopMatchingData(List <PRS_Process_BOM> data, string ParentCode, string OperationType)
        {
            try
            {
                db.UseTransaction(true);
                if (OperationType == "add")
                {
                    data.ForEach(item =>
                    {
                        MES_BN_WorkShopMatching model = new MES_BN_WorkShopMatching();
                        model.PartCode     = item.PartCode;
                        model.RootPartCode = ParentCode;
                        model.ProcessType  = "1";
                        model.WorkShopCode = "";
                        model.CreateTime   = DateTime.Now;
                        model.CreatePerson = MmsHelper.GetUserCode();
                        model.ParentCode   = item.ParentCode;
                        model.ContractCode = item.ContractCode;
                        model.IsEnable     = 1;
                        int result         = db.Insert <MES_BN_WorkShopMatching>("MES_BN_WorkShopMatching", model).AutoMap(a => a.ID).ExecuteReturnLastId <int>();
                    });
                }
                else if (OperationType == "update")
                {
                    var UpdateList = new List <int>();
                    new MES_BN_WorkShopMatchingService().Update(ParamUpdate.Instance()
                                                                .Update("MES_BN_WorkShopMatching")
                                                                .Column("IsEnable", 0)
                                                                .AndWhere("RootPartCode", ParentCode));

                    var MES_BN_WorkShopMatchingList = new MES_BN_WorkShopMatchingService().GetModelList(ParamQuery.Instance().AndWhere("RootPartCode", ParentCode));

                    data.ForEach(item =>
                    {
                        var PCode    = item.ParentCode; //父级编码
                        var PartCode = item.PartCode;   //子级编码
                        var IsExist  = MES_BN_WorkShopMatchingList.Where(a => a.ParentCode == PCode && a.PartCode == PartCode);
                        if (IsExist.Count() > 0)
                        {
                            int ID = IsExist.FirstOrDefault().ID;
                            UpdateList.Add(ID);
                        }
                        else
                        {
                            MES_BN_WorkShopMatching model = new MES_BN_WorkShopMatching();
                            model.PartCode     = item.PartCode;
                            model.RootPartCode = ParentCode;
                            model.ProcessType  = "1";
                            model.WorkShopCode = "";
                            model.CreateTime   = DateTime.Now;
                            model.CreatePerson = MmsHelper.GetUserCode();
                            model.ParentCode   = item.ParentCode;
                            model.ContractCode = item.ContractCode;
                            model.IsEnable     = 1;
                            int result         = db.Insert <MES_BN_WorkShopMatching>("MES_BN_WorkShopMatching", model)
                                                 .AutoMap(a => a.ID).ExecuteReturnLastId <int>();
                        }
                    });

                    if (UpdateList.Count > 0)
                    {
                        string UpdateStr = string.Join(",", UpdateList);
                        db.Sql($"update MES_BN_WorkShopMatching set IsEnable=1 where ID in({UpdateStr})").Execute();
                    }
                }
                db.Commit();
                return(true);
            }
            catch (Exception ex)
            {
                db.Rollback();
                return(false);
            }
        }
コード例 #26
0
        public ActionResult customerEdit(string id = "", string type = "")
        {
            uc         = new sys_codeService().Getsys_codeByTypeAndID("BillType", int.Parse(type));
            ViewBag.uc = uc;
            var loginer = FormsAuth.GetUserData <LoginerBase>();
            var user    = new SYS_BN_UserService().GetModel(ParamQuery.Instance().AndWhere("IsEnable", 1).AndWhere("UserCode", loginer.UserCode));
            //var department = new SYS_BN_UserService().GetDepartmentInfo(MmsHelper.GetUserCode());
            var department             = new SYS_BN_DepartmentService().GetModel(ParamQuery.Instance().AndWhere("IsEnable", 1).AndWhere("DepartmentCode", user.DepartmentCode));
            SYS_BN_Warehouse warehouse = new SYS_BN_Warehouse();

            if (department.DepartmentCode == "0107")
            {
                warehouse = new SYS_BN_WarehouseService().GetModel(ParamQuery.Instance().AndWhere("IsEnable", 1).AndWhere("UserCode", MmsHelper.GetUserCode()));
            }
            else
            {
                warehouse = new SYS_BN_WarehouseService().GetModel(ParamQuery.Instance().AndWhere("ISEnable", 1).AndWhere("WarehouseName", department.DepartmentName));
            }
            //var department=new SYS_BN_DepartmentService().GetIDNameList(MmsHelper.GetUserCode())



            warehouse    = warehouse ?? new SYS_BN_Warehouse();
            ViewBag.user = warehouse.WarehouseCode == null ? 0 : 1;

            var    data     = new WMS_BN_BillDetailApiController().GetPageData(id);
            string billCode = new WMS_BN_BillMainService().GetBillCodeByID(id);
            //string documentNo = MmsHelper.GetOrderNumber("WMS_BN_BillMain", "BillCode", uc.Description, "", "");
            var model = new
            {
                urls = new
                {
                    getdata     = "/api/Mms/WMS_BN_BillDetail/GetPageData/",    //获取主表数据及数据滚动数据api
                    edit        = "/api/Mms/WMS_BN_BillDetail/edit/",           //数据保存api
                    audit       = "/api/Mms/WMS_BN_BillDetail/audit/",          //审核api
                    newkey      = "/api/Mms/WMS_BN_BillDetail/GetNewRowId/",    //获取新的明细数据的主键(日语叫采番)
                    storageSave = "/api/Mms/WMS_BN_BillDetail/PostStorage/"
                },
                resx = new
                {
                    rejected    = "已撤消修改!",
                    editSuccess = "保存成功!",
                    auditPassed = "单据已通过审核!",
                    auditReject = "单据已取消审核!"
                },
                dataSource = new
                {
                    pageData = data,

                    DepartmentID   = department.DepartmentCode,
                    DepartmentName = department.DepartmentName,
                    WarehouseCode  = warehouse.WarehouseCode,
                    //payKinds = codeService.GetValueTextListByType("PayType")
                },
                form = new
                {
                    defaults    = new WMS_BN_BillMain().Extend(new { ID = data.scrollKeys.current, BillCode = data.form == null ? "系统生成" : data.form.BillCode, BillType = uc.Value, ContractCode = "", DepartmentID = "", DepartmentName = "", SupplierCode = "", WarehouseCode = warehouse.WarehouseCode, WarehouseName = warehouse.WarehouseName, ApproveState = "1", ApprovePerson = "", ApproveDate = "", ApproveRemark = "", Remark = "", CreatePerson = MmsHelper.GetUserName(), CreateTime = DateTime.Now, ModifyPerson = MmsHelper.GetUserName(), ModifyTime = DateTime.Now }),
                    primaryKeys = new string[] { "ID" }
                },
                tabs = new object[] {
                    new{
                        type       = "grid",
                        rowId      = "ID",
                        relationId = "ID",
                        postFields = new string[] { "ID", "BillCode", "OrderBillCode", "InventoryCode", "InventoryName", "Specs", "Unit", "MateNum", "ConfirmNum", "UnitPrice", "TotalPrice", "PackageCode", "BatchCode", "PBillCode", "AccountabilityCode", "Remark", "CreatePerson", "CreateTime", "ModifyPerson", "ModifyTime", "IsEnable" },
                        defaults   = new { ID = "", BillCode = billCode, InventoryCode = "", InventoryName = "", Unit = "", MateNum = "", ConfirmNum = "", PackageCode = "", BatchCode = "", PBillCode = "", AccountabilityCode = "", Remark = "", CreatePerson = "", CreateTime = "", ModifyPerson = "", ModifyTime = "", IsEnable = 1 }
                    }
                }
            };

            return(View("Edit", model));
        }
コード例 #27
0
        public void Edit(dynamic data)
        {
            dynamic depart = new SYS_BN_UserService().GetDepartment(MmsHelper.GetUserCode());
            string  code   = string.Empty;
            string  name   = string.Empty;

            if (depart != null)
            {
                code = depart.DepartmentCode;
                name = depart.DepartmentName;
            }

            if (data.form["TeamCode"] == "系统生成")
            {
                if (data.form["TeamName"] == "")
                {
                    MmsHelper.ThrowHttpExceptionWhen(true, "班组名称不能为空!", 0);
                    return;
                }
                string documentNo = MmsHelper.GetOrderNumber("SYS_WorkGroup", "BillCode", code, "", "");
                data.form["BillCode"] = documentNo;
                documentNo            = documentNo.Replace(DateTime.Now.ToString("yyMMdd") + "0", "");
                data.form["TeamCode"] = documentNo;
            }
            foreach (JToken tab in data["tabs"].Children())
            {
                foreach (JProperty item in tab.Children())
                {
                    if (item.Name == "deleted")
                    {
                        continue;
                    }
                    foreach (var row in item.Value.Children())
                    {
                        var pQuery = ParamQuery.Instance().Select("ID").AndWhere("UserCode", row["UserCode"]).AndWhere("IsEnable", 1);
                        var re     = new SYS_WorkGroupDetailService().GetModel(pQuery);
                        if (re != null)
                        {
                            if (re.ID > 0)
                            {
                                MmsHelper.ThrowHttpExceptionWhen(true, "员工" + row["UserName"] + "已在别的班组!", 0);
                                return;
                            }
                        }
                    }
                }
            }
            var formWrapper = RequestWrapper.Instance().LoadSettingXmlString(@"
<settings>
    <table>
        SYS_WorkGroup
    </table>
    <where>
        <field name='ID' cp='equal'></field>
    </where>
</settings>
");

            var tabsWrapper = new List <RequestWrapper>();

            tabsWrapper.Add(RequestWrapper.Instance().LoadSettingXmlString(@"
<settings>
    <table>SYS_WorkGroupDetail</table>
    <where>
        <field name='ID' cp='equal'></field>      
    </where>
</settings>"));

            var service = new SYS_WorkGroupService();
            var result  = service.EditPage(data, formWrapper, tabsWrapper);
        }
コード例 #28
0
        public string GetAudit2(string ContractCode, string partCode)
        {
            var now          = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
            var sqlprocess   = @"update MES_BN_ProductProcessRoute set ApproveState=1,ApprovePerson='" + MmsHelper.GetUserCode() + "',ApproveDate='" + now + "' where ContractCode='" + ContractCode + "' and PartCode='{0}' ";
            var sqlprocessex = "";

            List <PRS_Process_BOM> boomlist = GetGYBom(partCode);
            var ids = "(";

            foreach (var item in boomlist)
            {
                sqlprocessex += string.Format(@sqlprocess, item.PartCode);
                ids          += "'" + item.ID + "',";
            }
            ids  = ids.Remove(ids.Length - 1, 1);
            ids += ")";
            string sql = string.Format("update PRS_Process_BOM set ApproveState=1,ApprovePerson='{0}',ApproveDate='" + now + "' where ID in {1}", MmsHelper.GetUserCode(), ids);

            db.Sql(sql).Execute();

            db.Sql(sqlprocessex).Execute();

            return("3");
        }
コード例 #29
0
        public ActionResult Index()
        {
            var    user         = new SYS_BN_UserService().GetModel(ParamQuery.Instance().AndWhere("IsEnable", 1).AndWhere("UserCode", MmsHelper.GetUserCode()));
            string workshopName = new SYS_BN_DepartmentService().GetModel(ParamQuery.Instance().AndWhere("IsEnable", 1).AndWhere("DepartmentCode", user.DepartmentCode ?? "")).DepartmentName ?? "";
            var    model        = new
            {
                urls = new
                {
                    query  = "/api/Mms/MES_WorkshopBatching",
                    remove = "/api/Mms/MES_WorkshopBatching/",
                    billno = "/api/Mms/MES_WorkshopBatching/getnewbillno",
                    audit  = "/api/Mms/MES_WorkshopBatching/audit/",
                    edit1  = "/Mms/MES_WorkshopBatching/edit/"
                },
                resx = new
                {
                    detailTitle   = "单据明细",
                    noneSelect    = "请先选择一条单据!",
                    deleteConfirm = "确定要删除选中的单据吗?",
                    deleteSuccess = "删除成功!",
                    auditSuccess  = "单据已审核!"
                },
                dataSource = new
                {
                    //dsPurpose = new sys_codeService().GetValueTextListByType("Purpose")
                },
                form = new
                {
                    BatchingCode   = "",
                    ContractCode   = "",
                    DepartmentName = workshopName,
                    //WorkshopCode = "",
                },
                idField = "BatchingCode"
            };

            return(View(model));
        }
コード例 #30
0
        public void Edit(dynamic data)
        {
            dynamic depart = new SYS_BN_UserService().GetDepartment(MmsHelper.GetUserCode());
            string  code   = string.Empty;
            string  name   = string.Empty;

            if (depart != null)
            {
                code = depart.DepartmentCode;
                name = depart.DepartmentName;
            }

            var listWrapper = RequestWrapper.Instance().LoadSettingXmlString(@"
    <settings>
        <table>
            APS_ProjectProduceTemporaryTask
        </table>
        <where>
            <field name='ID' cp='equal'></field>
        </where>
    </settings>");
            var service     = new APS_ProjectProduceTemporaryTaskService();

            if (data.list.inserted.ToString() != "[]")
            {
                var dno = MmsHelper.GetOrderNumber("APS_ProjectProduceTemporaryTask", "BillCode", "LLRW", "", "");
                var fno = dno.Substring(0, 10);
                var con = dno.Substring(10, 3);

                foreach (JToken row in data["list"]["inserted"].Children())
                {
                    var pQuery = ParamQuery.Instance().Select("ApproveState").AndWhere("ID", row["ID"]);
                    var re     = new APS_ProjectProduceTemporaryTaskService().GetModel(pQuery);
                    if (re != null && re.ApproveState == "1")
                    {
                        MmsHelper.ThrowHttpExceptionWhen(true, "以审核不能保存", 0);
                        return;
                    }

                    row["BillCode"] = fno + con;
                    int intCon = Convert.ToInt32(con);
                    intCon++;
                    var zeros = 3 - intCon.ToString().Length;
                    con = "";
                    for (int i = 1; i <= zeros; i++)
                    {
                        con += "0";
                    }
                    con += intCon.ToString();
                    row["LaunchWorkshopID"]   = code;
                    row["LaunchWorkshopName"] = name;
                    row["IsEnable"]           = 1;
                }
            }
            if (data.list.deleted.ToString() != "[]")
            {
                foreach (JToken row in data["list"]["deleted"].Children())
                {
                    var pQuery = ParamQuery.Instance().Select("ApproveState").AndWhere("ID", row["ID"]);
                    var re     = new APS_ProjectProduceTemporaryTaskService().GetModel(pQuery);
                    if (re != null && re.ApproveState == "1")
                    {
                        MmsHelper.ThrowHttpExceptionWhen(true, "以审核不能删除", 0);
                        return;
                    }
                    row["IsEnable"] = 0;
                }
            }

            var result = service.Edit(null, listWrapper, data);
        }