Beispiel #1
0
        public void Delete(string id)
        {
            var service = new mms_drainpipeductService();
            var result  = service.Delete(ParamDelete.Instance().AndWhere("BillNo", id));

            MmsHelper.ThrowHttpExceptionWhen(result <= 0, "信息删除失败[BillNo={0}],请重试或联系管理员!", id);
        }
Beispiel #2
0
        public void Delete(string id)
        {
            var service = new mms_inspectionwellService();
            var result  = service.Delete(ParamDelete.Instance().AndWhere("BillNo", id).From("MANHOLE"));

            MmsHelper.ThrowHttpExceptionWhen(result <= 0, "信息删除失败[BillNo={0}],请重试或联系管理员!", id);
        }
Beispiel #3
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);
            }
        }
Beispiel #4
0
        public void Audit(string id, dynamic data)
        {
            var status  = data["status"].ToString();
            var comment = data["comment"].ToString();
            var result  = new MmsService().Audit(typeof(mms_drainpipeduct).Name, id, status, comment);

            MmsHelper.ThrowHttpExceptionWhen(result < 0, "信息审核失败[BillNo={0}],请重试或联系管理员!", id);
        }
Beispiel #5
0
        public virtual void Audit(string id, JObject data)
        {
            var status  = data["status"].ToString();
            var comment = data["comment"].ToString();
            var result  = new MmsService().Audit(typeof(TMasterModel).Name, id, status, comment);

            MmsHelper.ThrowHttpExceptionWhen(result < 0, "单据审核失败[Object_ID={0}],请重试或联系管理员!", id);
        }
Beispiel #6
0
        public void Audit(string id, JObject data)
        {
            var pUpdate = ParamUpdate.Instance()
                          .Update("SYS_BOM")
                          .Column("ApproveState", data["status"])
                          .Column("ApproveRemark", data["comment"])
                          .Column("ApprovePerson", FormsAuth.GetUserData().UserName)
                          .Column("ApproveDate", DateTime.Now)
                          .AndWhere("ID", id);

            var service      = new SYS_BOMService();
            var rowsAffected = service.Update(pUpdate);

            MmsHelper.ThrowHttpExceptionWhen(rowsAffected < 0, "单据审核失败[BillNo={0}],请重试或联系管理员!", id);
        }
Beispiel #7
0
        public void Audit(dynamic data)
        {
            var pUpdate = ParamUpdate.Instance()
                          .Update("MES_WorkshopPurchaseMain")
                          .Column("ApproveState", data.form.status.ToString())
                          .Column("ApproveRemark", data.form.comment.ToString())
                          .Column("ApprovePerson", FormsAuth.GetUserData().UserName)
                          .Column("ApproveDate", DateTime.Now)
                          .AndWhere("ID", data.form.ID.ToString());

            var service      = new MES_WorkshopPurchaseMainService();
            var rowsAffected = service.Update(pUpdate);

            MmsHelper.ThrowHttpExceptionWhen(rowsAffected < 0, "单据审核失败[BillNo={0}],请重试或联系管理员!");
        }
 protected override void OnAfterHandleExcel(ref System.Data.DataTable dtSheet)
 {
     foreach (DataRow item in dtSheet.Rows)
     {
         string dName = item["WarehouseName"].ToString();
         string sql   = string.Format(@"select ID from SYS_BN_Warehouse where WarehouseName='{0}'", dName);
         int    hID   = db.Sql(sql).QuerySingle <int>();
         if (hID == 0)
         {
             MmsHelper.ThrowHttpExceptionWhen(true, "仓库名:" + dName + "错误,请检查数据", "");
             return;
         }
         item["WarehouseCode"] = hID;
     }
     base.OnAfterHandleExcel(ref dtSheet);
 }
Beispiel #9
0
        public void Edit(dynamic data)
        {
            var service = new MES_WorkshopPurchaseMainService();

            if (data.form["WorkshopPurchaseCode"] != "系统生成")
            {
                var pQuery = ParamQuery.Instance().Select("*").AndWhere("ID", data.form["ID"]);
                MES_WorkshopPurchaseMain model = service.GetModel(pQuery);
                if (model.ApproveState != null && model.ApproveState == "2")
                {
                    MmsHelper.ThrowHttpExceptionWhen(true, "已发布的不能修改!");
                    return;
                }
            }


            var formWrapper = RequestWrapper.Instance().LoadSettingXmlString(@"
<settings>
    <table>
        MES_WorkshopPurchaseMain
    </table>
    <where>
        <field name='ID' cp='equal'></field>
    </where>
</settings>
");

            var tabsWrapper = new List <RequestWrapper>();

            tabsWrapper.Add(RequestWrapper.Instance().LoadSettingXmlString(@"
<settings>
    <table>MES_WorkshopPurchaseDetail</table>
    <where>
        <field name='ID' cp='equal'></field>      
    </where>
</settings>"));
            if (data.form["WorkshopPurchaseCode"] == "系统生成")
            {
                string documentNo = MmsHelper.GetOrderNumber("MES_WorkshopPurchaseMain", "WorkshopPurchaseCode", "CJQG", "", "");
                data.form["WorkshopPurchaseCode"] = documentNo;
            }
            var result = service.EditPage(data, formWrapper, tabsWrapper);
        }
        public void Edit(dynamic data)
        {
            var id     = data.form["ID"].ToString();
            var pQuery = ParamQuery.Instance().Select("*").AndWhere("ID", id);
            var re     = new PRS_ProcessRouteModelMainService().GetModelList(pQuery);

            if (re.Count > 0 && re[0].BillState == 1)
            {
                MmsHelper.ThrowHttpExceptionWhen(true, "已审核数据不能修改!");
                return;
            }
            var formWrapper = RequestWrapper.Instance().LoadSettingXmlString(@"
<settings>
    <table>
        PRS_ProcessRouteModelMain
    </table>
    <where>
        <field name='ID' cp='equal'></field>
    </where>
</settings>
");

            var tabsWrapper = new List <RequestWrapper>();

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

            var service = new PRS_ProcessRouteModelMainService();

            if (data.form["ProcessRouteCode"] == "系统生成")
            {
                string documentNo = MmsHelper.GetLSNumber("PRS_ProcessRouteModelMain", "ProcessRouteCode", "GYMX", "", "");
                data.form["ProcessRouteCode"] = documentNo;
            }


            var result = service.EditPage(data, formWrapper, tabsWrapper);
        }
Beispiel #11
0
        // 删除 DELETE api/mms/send
        public virtual void Delete(string id)
        {
            var result = masterService.Delete(ParamDelete.Instance().Where("BillNo", id));

            MmsHelper.ThrowHttpExceptionWhen(result <= 0, "单据删除失败[BillNo={0}],请重试或联系管理员!", id);
        }
        public void Edit(dynamic data)
        {
            var serviceMain     = new WMS_BN_TakeStockMainService();
            var formWrapperMain = RequestWrapper.Instance().LoadSettingXmlString(@"
            <settings>
                <table>
                    WMS_BN_TakeStockMain
                </table>
                <where>
                    <field name='ID' cp='equal'></field>
                </where>
            </settings>
            ");

            var formWrapperDetail = RequestWrapper.Instance().LoadSettingXmlString(@"
                <settings>
                    <table>
                        WMS_BN_TakeStockDetail
                    </table>
                    <where>
                        <field name='ID' cp='equal'></field>
                    </where>
                </settings>
                ");

            //.GetNewKey("ID", "maxplus");
            //判断当前是否首次保存首次保存产生单号
            //var currentID = data["form"]["ID"];
            //var pQuery = ParamQuery.Instance().AndWhere("ID", currentID);
            //var currentInfo = serviceMain.GetModel(pQuery);

            //dynamic qm = new
            //{
            //    month = data["form"]["TakeStockYear"],
            //    year = data["form"]["TakeStockYear"]
            //};
            //if (currentInfo == null)
            //{

            //    var code = serviceMain.GetMaxBillCode(qm);
            //    data["form"]["BillCode"] = code;
            //}

            //判断是否是新增,是的话就判断一个月只能保存一条盘点数据
            dynamic qm = new
            {
                month = data["form"]["TakeStockMonth"],
                year  = data["form"]["TakeStockYear"]
            };

            if (qm.month != null || qm.year != null)
            {
                if (serviceMain.GetTakeStock(Convert.ToInt32(qm.year), Convert.ToInt32(qm.month)) > 0)
                {
                    MmsHelper.ThrowHttpExceptionWhen(true, "一个月只能生成一次盘点!", "");
                }
            }
            var tabsWrapper = new List <RequestWrapper>();

            tabsWrapper.Add(formWrapperDetail);
            var service = new WMS_BN_TakeStockDetailService();
            var result  = service.EditPage(data, formWrapperMain, tabsWrapper);
        }
        public void Edit(dynamic data)
        {
            var service = new MES_MaterialPickMainService();

            if (data.form["BillCode"] != "系统生成")
            {
                var pQuery = ParamQuery.Instance().Select("*").AndWhere("ID", data.form["ID"]);
                MES_MaterialPickMain model = service.GetModel(pQuery);
                if (model.BillState != null && model.BillState == 2)
                {
                    MmsHelper.ThrowHttpExceptionWhen(true, "已发布的不能修改!");
                    return;
                }
            }
            var ids = "(";

            foreach (JToken tab in data["tabs"].Children())
            {
                foreach (JProperty item in tab.Children())
                {
                    if (item.Name == "deleted")
                    {
                        foreach (var row in item.Value.Children())
                        {
                            ids += "'" + row["ID"] + "',";
                        }
                        item.Value = "[]";
                    }
                }
            }
            if (ids != "(")
            {
                ids  = ids.Remove(ids.Length - 1, 1);
                ids += ")";
                using (var db = Db.Context("Mms"))
                {
                    string sql1 = string.Format("update MES_MaterialPickDetail set IsEnable=0 where ID in {0} ", ids);
                    db.Sql(sql1).Execute();
                }
            }

            var formWrapper = RequestWrapper.Instance().LoadSettingXmlString(@"
<settings>
    <table>
        MES_MaterialPickMain
    </table>
    <where>
        <field name='ID' cp='equal'></field>
    </where>
</settings>
");



            var tabsWrapper = new List <RequestWrapper>();

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

            if (data.form["BillCode"] == "系统生成")
            {
                string documentNo = MmsHelper.GetOrderNumber("MES_MaterialPickMain", "BillCode", "CJLL", "", "");
                data.form["BillCode"] = documentNo;
            }
            var result = service.EditPage(data, formWrapper, tabsWrapper);
        }
Beispiel #14
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);
        }
Beispiel #15
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);
        }