Explorar el Código

业务后台代码更新

chen_yjin hace 7 meses
padre
commit
074a39d717

+ 143 - 0
JLHHJSvr/BLL/FuncPowerHelper.cs

@@ -0,0 +1,143 @@
+using JLHHJSvr.DBA.DBModle;
+using JLHHJSvr.LJException;
+using LJLib.DAL.SQL;
+using System;
+using System.Collections.Generic;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace JLHHJSvr.BLL
+{
+    internal class FuncPowerHelper
+    {
+        public static Dictionary<int, string> _stupidFunc = new Dictionary<int, string>
+        {
+            {703,"销售报价单隐藏成本" },
+            {2179,"销售发货单不显示客户欠款情况" },
+            {2402,"销售发货单单价不允许编辑" },
+            {2403,"销售订单单价不允许编辑" },
+            {2635,"销售订单必须选择订单分类" },
+            {3066,"销售发货单仓审后不能打印" },
+            {3158,"销售订单折扣不允许编辑" },
+            {3159,"销售发货单折扣不允许编辑" },
+            {3200,"调出明细只能选公共库存" },
+            {3201,"调货时只能调空闲库存" },
+            {3672,"销售订单0单价不允许保存" },
+            {3703,"只允许修改自己及下级用户建立的单据" },
+            {3704,"只允许修改自己及下级用户建立的单据" },
+            {3712,"不允许审核订单明细没有默认供应商的采购订单" },
+            {3713,"不允许审核订单明细没有申购单的采购订单" },
+            {3714,"不允许审核订单明细没有采购合同的采购订单" },
+            {3715,"不能仓库审核有实发数与计划发货数不相等的发货单" },
+            {3847,"明细只能选择工序" },
+            {3890,"客户补件单确认后才能打印" },
+            {3905,"明细不能选择更新原订单" },
+            {3910,"已打印的销售发货单不能撤审" },
+            {3911,"销售发货单不允许重复打印" },
+            {3990,"销售订单审核检查审核日期+生产周期<=订单明细交期" },
+            {4141,"建立日期和计件月份不允许修改" },
+            {4169,"不允许查看无效物料" },
+            {4200,"销售发货单仓审日期不能早于销售日期" },
+            {4354,"板式销售意向单单价不允许编辑" },
+            {4355,"板式销售意向单折扣不允许编辑" },
+            {4365,"不允许审核订单明细有0单价的采购订单" },
+            {4366,"不允许审核订单明细有0单价的采购订单" },
+            {4400,"销售发货单0单价不允许保存" },
+            {4427,"销售报价不能低于标准销售价" },
+            {4428,"销售订单严格按照客户指定的货运部选择" },
+            {4429,"销售发货单严格按照客户指定的货运部选择" },
+            {4535,"不允许编辑单价" },
+            {4555,"单价少于定价不能审核" },
+            {4615,"编辑状态下不允许删除明细" },
+            {4616,"编辑状态下不允许删除明细" },
+            {4690,"不允许审核订单明细有0单价的采购订单" },
+            {4843,"必须选销售退货单明细" },
+            {4883,"不允许重复打印派工单的权限" },
+            {5078,"不允许编辑工价" },
+            {5168,"不允许修改单价" },
+            {5201,"销售限价为0不能审核" },
+            {5207,"销售退货单不允许重复打印" },
+            {5274,"只能查看自己建立的单据" },
+            {5289,"明细没有合同不允许审核" },
+            {5290,"明细没有单价不允许审核" },
+            {5291,"明细没有默认供应商不允许审核" },
+            {5599,"隐藏规格参数页" },
+            {5633,"只允许查看自己建立的单据" },
+            {5634,"只允许查看自己建立的单据" },
+            {5734,"不允许编辑单价" },
+            {5738,"不允许修改明细员工" },
+            {5739,"不允许修改客户折扣" },
+            {5740,"不允许修改客户折扣" },
+            {5795,"限制派工员工受限于工种技术等级" },
+            {5888,"只允许修改自己及下级用户建立的单据" },
+            {6007,"税率为0不允许保存" },
+            {6008,"税率为0不允许保存" },
+            {6027,"只允许操作有权限工段的排程" },
+            {6256,"隐藏绩效分页" },
+            {6371,"借用原因只能选不能录入" },
+            {6390,"报销内容不能为空白或金额为0" },
+            {6444,"定价为0不能审核" },
+            {6502,"只能显示自己建立的单据" },
+            {6503,"只能修改自己建立的单据" },
+            {6527,"财审前修改费用明细" },
+            {6548,"不允许保存调入日期和调出日期不一致的单据" },
+            {6573,"隐藏费用明细页" },
+            {6580,"出口销售订单单价不允许编辑" },
+            {6725,"限制录入客户信息" },
+            {6727,"销售发货单0税率不允许保存" },
+            {6777,"只能修改自己建立的单据" },
+            {6807,"不允许修改客户币种" },
+            {6808,"不允许修改供应商币种" },
+            {6809,"不允许修改客户币种" },
+            {6835,"必须选择部门" },
+            {6836,"必须选择部门" },
+            {6845,"不允许保存订单明细0单价的采购订单" },
+        };
+        /// <summary>
+        /// 包含对反转权限的转义,有权限/无限制返回true,无权限/有限制返回false
+        /// </summary>
+        public static bool CheckFuncPower(SqlCommand cmd, int empid, int funcid)
+        {
+            if (empid == 0)
+            {
+                return true;
+            }
+            var user = new u_user_jlhprice() { empid = empid };
+            if (DbSqlHelper.SelectOne(cmd, user, "Empid,rightstring") != 1)
+            {
+                throw new LJCommonException(string.Format("查询用户信息失败,empid:{0}", empid));
+            }
+            var ifStupidFunc = false;
+            if (_stupidFunc.ContainsKey(funcid))
+            {
+                ifStupidFunc = true;
+            }
+            else
+            {
+                cmd.CommandText = "SELECT parentid FROM sys_func_pwr WHERE funcid = " + funcid;
+                cmd.Parameters.Clear();
+                using (var reader = cmd.ExecuteReader())
+                {
+                    if (reader.Read())
+                    {
+                        if (Convert.ToInt32(reader["parentid"]) == 521)
+                        {
+                            ifStupidFunc = true;
+                        }
+                    }
+                }
+            }            
+            var funcVal = GetFuncPowerVal(funcid, user.rightstring);
+            return funcVal != ifStupidFunc;
+        }
+        private static bool GetFuncPowerVal(int funcid, string sys_pwrstr)
+        {
+            bool rslt;
+            rslt = funcid > 0 && sys_pwrstr.Length >= funcid &&
+                       sys_pwrstr.Substring(funcid - 1, 1) == "1";
+            return rslt;
+        }
+    }
+}

+ 4 - 0
JLHHJSvr/BLL/TokenData.cs

@@ -15,5 +15,9 @@ namespace JLHHJSvr.BLL
         /// 用户姓名
         /// </summary>
         public string username { get; set; }
+        /// <summary>
+        /// 用户模式
+        /// </summary>
+        public int usermode { get; set; }
     }
 }

+ 25 - 0
JLHHJSvr/Com/GetFormulaCompute.cs

@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using JLHHJSvr.Com.Model;
+using JLHHJSvr.DBA.DBModle;
+using LJLib.Net.SPI.Com;
+
+namespace JLHHJSvr.Com
+{
+    public sealed class GetFormulaComputeRequest : ILJRequest<GetFormulaComputeResponse>
+    {
+        public string GetApiName()
+        {
+            return "GetFormulaCompute";
+        }
+        public string token { get; set; }
+        public List<string> formulas { get; set; }
+    }
+
+    public sealed class GetFormulaComputeResponse : LJResponse
+    {
+        public List<decimal> values { get; set; } 
+    }
+}

+ 1 - 0
JLHHJSvr/Com/Login.cs

@@ -41,5 +41,6 @@ namespace JLHHJSvr.Com
         /// 可用权限列表
         /// </summary>
         public List<int> rsltFunids { get; set; }
+        public int usermode { get; set; }
     }
 }

+ 138 - 0
JLHHJSvr/Com/Model/u_mattress.cs

@@ -0,0 +1,138 @@
+using LJLib.DAL.SQL;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace JLHHJSvr.Com.Model
+{
+    [PK(new[] { "mattressid" })]
+    public sealed class u_mattress
+    {
+        public int? mattressid { get; set; }
+        public int? deptid { get; set; }
+        public int? mattresstypeid { get; set; }
+        public int? mattress_width { get; set; }
+        public int? mattress_length { get; set; }
+        public int? mattress_height { get; set; }
+        public int? packtype { get; set; }
+        public int? packqty { get; set; }
+        public int? woodpallettype { get; set; }
+        public decimal? total_hr_cost { get; set; }
+        public decimal? total_material_cost { get; set; }
+        public string fees_dscrp { get; set; }
+        public decimal? total_fees_cost { get; set; }
+        public decimal? total_cost { get; set; }
+        public decimal? taxrate { get; set; }
+        public decimal? taxes { get; set; }
+        public decimal? commissionrate { get; set; }
+        public decimal? commission { get; set; }
+        public decimal? fob { get; set; }
+        public decimal? profitrate { get; set; }
+        public DateTime? createtime { get; set; }
+        public string createby { get; set; }
+        public decimal? extras_cost { get; set; }
+        public decimal? dept_profitrate { get; set; }
+        public decimal? moneyrate { get; set; }
+        public decimal? nottax_factory_cost { get; set; }
+        public decimal? nottax_dept_cost { get; set; }
+        public decimal? dept_cost { get; set; }
+        public decimal? foreign_cost { get; set; }
+        public string mattresscode { get; set; }
+        public string mattressname { get; set; }
+        public decimal? diameter { get; set; }
+        public string area { get; set; }
+        public string cabinet_type { get; set; }
+        public string loading_type { get; set; }
+        public decimal? hrcost { get; set; }
+        public decimal? biandaicost { get; set; }
+        public string fob_replace_formula { get; set; }
+        public string hrcost_replace_formula { get; set; }
+        public string biandaicost_replace_formula { get; set; }
+        public string mattressrelcode { get; set; }
+        public decimal? other_rate { get; set; }
+        public string gydscrp { get; set; }
+        public int? flag { get; set; }
+        public decimal? dept_profitrate_rangli { get; set; }
+        public string auditingrep { get; set; }
+        public DateTime? auditingdate { get; set; }
+        public decimal? profitrate_point { get; set; }
+        public int? if_moneyrate { get; set; }
+        public decimal? discount { get; set; }
+        public int? if_discount { get; set; }
+        public int? erp_mtrlid { get; set; }
+        public int? erp_configcodetype { get; set; }
+        public string erp_mtrlcode { get; set; }
+        public string erp_mtrlname { get; set; }
+        public string erp_mtrlmode { get; set; }
+        public int? erp_mtrltypeid { get; set; }
+        public string erp_mtrltype { get; set; }
+        public string erp_mtrlunit { get; set; }
+        public string erp_mtrlengname { get; set; }
+        public string erp_piccode { get; set; }
+        public int? yw_flag { get; set; }
+        public string yw_auditingrep { get; set; }
+        public DateTime? yw_auditingdate { get; set; }
+        public int? js1_flag { get; set; }
+        public string js1_auditingrep { get; set; }
+        public DateTime? js1_auditingdate { get; set; }
+        public int? js2_flag { get; set; }
+        public string js2_auditingrep { get; set; }
+        public DateTime? js2_auditingdate { get; set; }
+        public int? creatmtrl_flag { get; set; }
+        public string creatmtrl_auditingrep { get; set; }
+        public DateTime? creatmtrl_auditingdate { get; set; }
+        public int? creatmtrlqd_flag { get; set; }
+        public string creatmtrlqd_auditingrep { get; set; }
+        public DateTime? creatmtrlqd_auditingdate { get; set; }
+        public int? if_m_chai { get; set; }
+        public int? if_z_chai { get; set; }
+        public int? if_d_chai { get; set; }
+        public int? if_n_butao { get; set; }
+        public int? if_w_butao { get; set; }
+        public int? if_m_wbutao_way { get; set; }
+        public int? if_db_wbutao_way { get; set; }
+        public decimal? s_cover_qty { get; set; }
+        public decimal? z_cover_qty { get; set; }
+        public decimal? x_cover_qty { get; set; }
+        public decimal? biandai_qty { get; set; }
+        public decimal? s_m_cover_qty { get; set; }
+        public decimal? z_m_cover_qty { get; set; }
+        public decimal? x_m_cover_qty { get; set; }
+        public decimal? butao_point { get; set; }
+        public decimal? chaizhuang_point { get; set; }
+        public int? if_haimian_type { get; set; }
+        public decimal? haimian_point { get; set; }
+        public int? if_zhedie_type { get; set; }
+        public string old_mtrlname { get; set; }
+        public int? xd_flag { get; set; }
+        public string xd_auditingrep { get; set; }
+        public DateTime? xd_auditingdate { get; set; }
+        public int? qr_flag { get; set; }
+        public string qr_auditingrep { get; set; }
+        public DateTime? qr_auditingdate { get; set; }
+        public string temp_code { get; set; }
+        public DateTime? erp_cb_updatetime { get; set; }
+        public int? bcptypeid { get; set; }
+        public int? if_bcp_type { get; set; }
+        public int? bcp_m_id { get; set; }
+        public string bcp_m_name { get; set; }
+        public int? bcp_d_id { get; set; }
+        public string bcp_d_name { get; set; }
+        public int? bcp_dc_id { get; set; }
+        public string bcp_dc_name { get; set; }
+        public int? bcp_xc_id { get; set; }
+        public string bcp_xc_name { get; set; }
+        public int? bcp_vc_id { get; set; }
+        public string bcp_vc_name { get; set; }
+        public int? bcp_cw_id { get; set; }
+        public string bcp_cw_name { get; set; }
+        public decimal? zhizao_amt { get; set; }
+        public decimal? guanli_rate { get; set; }
+        public decimal? dannum_rate { get; set; }
+        public decimal? cubage { get; set; }
+        public decimal? foreign_cost_bz { get; set; }
+        public decimal? foreign_cost_dd { get; set; }
+
+    }
+}

+ 41 - 0
JLHHJSvr/Com/Model/u_mattress_mx_mtrl.cs

@@ -0,0 +1,41 @@
+using LJLib.DAL.SQL;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace JLHHJSvr.Com.Model
+{
+    [PK(new[] { "mattressmxid" })]
+    public sealed class u_mattress_mx_mtrl
+    {
+        public int? mattressmxid { get; set; }
+        public int? mattressid { get; set; }
+        public int? formulaid { get; set; }
+        public string formula { get; set; }
+        public int? mtrlid { get; set; }
+        public decimal? price { get; set; }
+        public decimal? gram_weight { get; set; }
+        public decimal? cloth_width { get; set; }
+        public int? if_inputqty { get; set; }
+        public decimal? qty { get; set; }
+        public decimal? costamt { get; set; }
+        public int? if_15strip { get; set; }
+        public int? if_success { get; set; }
+        public decimal? shrinkage { get; set; }
+        public string replace_formula { get; set; }
+        public string priceunit { get; set; }
+        public byte? if_areaprice { get; set; }
+        public decimal? thickness { get; set; }
+        public string chastr { get; set; }
+        public string dv_dscrp { get; set; }
+        public decimal? xu { get; set; }
+        public decimal? useqty { get; set; }
+        public string useformula { get; set; }
+        public string replace_useformula { get; set; }
+        public string gydscrp { get; set; }
+        public string cw_erpmtrlcode { get; set; }
+        public int? erp_mtrlid { get; set; }
+
+    }
+}

+ 61 - 0
JLHHJSvr/Com/SaveMattress.cs

@@ -0,0 +1,61 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using JLHHJSvr.Com.Model;
+using LJLib.Net.SPI.Com;
+
+namespace JLHHJSvr.Com
+{
+    /// <summary>
+    /// 保存车辆信息
+    /// </summary>
+    public sealed class SaveMattressRequest : ILJRequest<SaveMattressResponse>
+    {
+        public string GetApiName()
+        {
+            return "SaveMattress";
+        }
+        public string token { get; set; }
+        /// <summary>
+        /// 床垫信息:主表
+        /// </summary>
+        public u_mattress mattress { get; set; }
+        /// <summary>
+        /// 面料
+        /// </summary>
+        public List<u_mattress_mx_mtrl> mianliao { get; set; }
+        /// <summary>
+        /// 垫层
+        /// </summary>
+        public List<u_mattress_mx_mtrl> dianceng { get; set; }
+        /// <summary>
+        /// 辅料
+        /// </summary>
+        public List<u_mattress_mx_mtrl> fuliao { get; set; }
+        /// <summary>
+        /// 包装
+        /// </summary>
+        public List<u_mattress_mx_mtrl> baozhuang { get; set; }
+        /// <summary>
+        /// 杂料
+        /// </summary>
+        public List<u_mattress_mx_mtrl> zaliao { get; set; }
+        /// <summary>
+        /// 床网
+        /// </summary>
+        public List<u_mattress_mx_mtrl> chuangwang { get; set; }
+        /// <summary>
+        /// 内布套
+        /// </summary>
+        public List<u_mattress_mx_mtrl> neibutao { get; set; }
+        /// <summary>
+        /// 外布套
+        /// </summary>
+        public List<u_mattress_mx_mtrl> waibutao { get; set; }
+    }
+
+    public sealed class SaveMattressResponse : LJResponse
+    {
+    }
+}

+ 20 - 0
JLHHJSvr/DataStore/_Mapper_bednet.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<select>
+	<selectstr>
+		SELECT u_bednet.bednetid,
+		rtrim(u_bednet_type.typename)+ ' ' +  rtrim(u_bednet.bednetcode)+ ' '+cast(u_bednet.mattress_width as char(3))+ '*'
+		+cast(u_bednet.mattress_length as char(3))+ '*'+cast(u_bednet.mattress_height as char(3)) as bednetname
+
+		FROM u_bednet,
+		u_bednet_type
+		WHERE ( u_bednet.bednettypeid = u_bednet_type.bednettypeid )
+
+	</selectstr>
+	<where>
+		<when>
+			
+		</when>
+	</where>
+	<displayfields>
+	</displayfields>
+</select>

+ 7 - 1
JLHHJSvr/DataStore/_Mapper_deptid.xml

@@ -2,10 +2,16 @@
 <select>
   <selectstr>
 SELECT u_dept.deptid,
-	u_dept.deptname
+	u_dept.deptname,
+	moneyrate,
+	discount,
+	pricelistid
 FROM u_dept
   </selectstr>
   <where>
+	  <when notnull="@arg_deptid">
+		  u_dept.deptid = @arg_deptid
+	  </when>
   </where>
   <displayfields>
   </displayfields>

+ 15 - 0
JLHHJSvr/DataStore/_Mapper_dianceng_area.xml

@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<select>
+	<selectstr>
+		SELECT
+		--top 0
+		mtrlid,
+		name
+		FROM u_mtrl_price
+		WHERE u_mtrl_price.mtrltype = 2
+	</selectstr>
+	<where>
+	</where>
+	<displayfields>
+	</displayfields>
+</select>

+ 6 - 1
JLHHJSvr/DataStore/_Mapper_mattresstypeid.xml

@@ -4,7 +4,12 @@
 		select
 		mattresstypeid,
 		typename,
-		typecode
+		typecode,
+		if_top_side,
+		if_button_sdie,
+		if_big_side ,
+		if_small_side,
+		if_v_side
 		from
 		u_mattress_type
 	</selectstr>

+ 40 - 3
JLHHJSvr/DataStore/web_mattress.xml

@@ -22,8 +22,19 @@
 		commission,
 		fob,
 		profitrate,
+		profitrate_point,
+		butao_point,
+		chaizhuang_point,
+		haimian_point,
+		dannum_rate,
+		hrcost,
+		biandaicost,
+		zhizao_amt,
+		guanli_rate,
+		discount,
 		extras_cost,
 		dept_profitrate,
+		dept_profitrate_rangli,
 		moneyrate,
 		mattressrelcode,
 		flag,
@@ -49,8 +60,22 @@
 		erp_mtrlcode,
 		erp_cb_updatetime,
 		if_bcp_type,
+		if_zhedie_type,
+		if_w_butao,
+		biandai_qty,
 		other_rate,
-		if_moneyrate
+		if_moneyrate,
+		if_m_chai,
+		if_z_chai,
+		if_d_chai,
+		if_n_butao,
+		if_m_wbutao_way,
+		s_cover_qty,
+		z_cover_qty,
+		x_cover_qty,
+		s_m_cover_qty,
+		z_m_cover_qty,
+		x_m_cover_qty
 
 		From u_mattress
 	</selectstr>
@@ -88,7 +113,7 @@
 		<field field="xd_flag" datatype="checkbox">下单</field>
 		<field field="js1_flag" datatype="checkbox">产品补充审核</field>
 		<field field="flag" datatype="checkbox">财务审核</field>
-		<field field="deptid" mapper="" ddd="ddd_mattress_dept_choose">部门</field>
+		<field field="deptid" mapper="" ddd="ddd_mattress_dept_choose" align="left">部门</field>
 		<field field="mattresscode">报价唯一码</field>
 		<field field="mattressrelcode">床垫编码</field>
 		<field field="mattressname">床垫名称</field>
@@ -110,7 +135,7 @@
 		<field field="yongjin" datatype="number" compute="dijia_cost / (1 - (commission - 1 )) - dijia_cost">佣金</field>
 		<field field="taxrate" datatype="number">税率</field>
 		<field field="fob" datatype="number">FOB</field>
-		<field field="moneyrate" datatype="number"  mapper="u_mattress.if_moneyrate">汇率</field>
+		<field field="moneyrate" mapper="u_mattress.if_moneyrate">汇率</field>
 		<field field="createby">登记人</field>
 		<field field="createtime" datatype="datetime">登记时间</field>
 		<field field="auditingrep">审核人</field>
@@ -126,5 +151,17 @@
 		<field field="commission">佣金点数</field>
 		<field field="other_rate">额外点数</field>
 		<field field="extras_cost">额外费用</field>
+		<field field="if_bcp_type" datatype="checkbox">半成品</field>
+		<field field="if_w_butao" datatype="checkbox">顶布裥棉</field>
+		<field field="biandai_qty" datatype="number">边带数</field>
+		<field field="if_m_chai" datatype="checkbox">面拆</field>
+		<field field="if_n_butao" datatype="checkbox">内布套</field>
+		<field field="s_cover_qty" datatype="number">内布套上覆</field>
+		<field field="z_cover_qty" datatype="number">内布套侧覆</field>
+		<field field="x_cover_qty" datatype="number">内布套下覆</field>
+		<field field="if_m_wbutao_way" datatype="checkbox">面料外布套做法</field>
+		<field field="s_m_cover_qty" datatype="number">面层向大侧覆盖</field>
+		<field field="z_m_cover_qty" datatype="number">大侧向底层覆盖</field>
+		<field field="x_m_cover_qty" datatype="number">底层向大侧覆盖</field>
 	</displayfields>
 </select>

+ 15 - 0
JLHHJSvr/DataStore/web_mattress_formulalist.xml

@@ -20,7 +20,22 @@ SELECT formulaid
 FROM u_mattress_formula
   </selectstr>
   <where>
+	  <when notempty="@@arg_array_formulakind@@">
+		  u_mattress_formula.formulakind IN (@@arg_array_formulakind@@)
+	  </when>
+	  <when notempty="@@arg_array_formulatype@@">
+		  u_mattress_formula.formulatype IN (@@arg_array_formulatype@@)
+	  </when>
+	  <when notempty="@@arg_array_formulaid@@">
+		  u_mattress_formula.formulaid IN (@@arg_array_formulaid@@)
+	  </when>
+	  <when notnull="@arrg_usetype">
+		  u_mattress_formula.usetype = @arrg_usetype
+	  </when>
   </where>
+	<orderstr>
+		formulatype, sortcode
+	</orderstr>
   <displayfields>
     <field field="row" compute="getrow()">序</field>
     <field field="formulatype" mapper="">类别</field>

+ 29 - 14
JLHHJSvr/DataStore/web_mattress_mx.xml

@@ -8,6 +8,7 @@
 			u_mattress_mx_mtrl.formula as  formula,
 			u_mattress_mx_mtrl.formulaid,
 			u_mattress_mx_mtrl.mtrlid,
+			vv_mtrl_price.mtrlname,
 			u_mattress_mx_mtrl.price,
 			u_mattress_mx_mtrl.gram_weight,
 			u_mattress_mx_mtrl.cloth_width,
@@ -35,6 +36,17 @@
 		From u_mattress_mx_mtrl
 		Left join u_mattress_formula On u_mattress_formula.formulaid = u_mattress_mx_mtrl.formulaid left outer join u_mtrl_price on
 		u_mattress_mx_mtrl.mtrlid = u_mtrl_price.mtrlid
+		Left OUTER JOIN (
+			select
+				mtrlid,
+				name as mtrlname
+			from u_mtrl_price
+			union all
+				select top 1
+				0 as mtrlid,
+				' ' as mtrlname
+				from u_user_jlhprice
+		) AS vv_mtrl_price on vv_mtrl_price.mtrlid = u_mattress_mx_mtrl.mtrlid
 	</selectstr>
 	<where>
 		<when notnull="@arg_mattressid">
@@ -44,9 +56,12 @@
 			u_mattress_formula.formulatype in (@@arg_formulatype@@)
 		</when>
 	</where>
+	<orderstr>
+		formulatype, xu, sortcode, formulaid
+	</orderstr>
 	<displayfields>
 		<field field="pid" compute="getrow()">序</field>
-		<field field="if_success" datatype="checkbox">
+		<field field="if_success" datatype="checkbox" onlyusermode="0">
 			计算
 			成功?
 		</field>
@@ -56,42 +71,42 @@
 		<field field="formulakind" table="u_mattress_formula" mapper="" ddd="ddd_mattress_formula_formulakind">公式名</field>
 		<field field="if_mtrl" table="u_mattress_formula" datatype="checkbox">按物料?</field>
 		<field field="thickness" datatype="number">厚度cm</field>
-		<field field="mtrlid" mapper="u_mattress_mx_mtrl.mtrl_price" ddd="ddd_mtrl_price">物料</field>
+		<field field="mtrlname">物料</field>
 		<field field="qty" datatype="number">数量/长度</field>
-		<field field="price" datatype="number">
+		<field field="price" datatype="number" onlyusermode="0">
 			物料
 			单价
 		</field>
 		<field field="priceunit">单位</field>
-		<field field="shrinkage" datatype="number">收缩率</field>
-		<field field="gram_weight" datatype="number">克重</field>
-		<field field="cloth_width" datatype="number">幅宽</field>
-		<field field="if_inputqty" datatype="checkbox">
+		<field field="shrinkage" onlyusermode="0" datatype="number">收缩率</field>
+		<field field="gram_weight" datatype="number" onlyusermode="0">克重</field>
+		<field field="cloth_width" datatype="number" onlyusermode="0">幅宽</field>
+		<field field="if_inputqty" datatype="checkbox" onlyusermode="0">
 			固定
 			厚度?
 		</field>
-		<field field="if_areaprice" datatype="checkbox">
+		<field field="if_areaprice" datatype="checkbox" onlyusermode="0">
 			按面积
 			单价?
 		</field>
-		<field field="costamt" datatype="number">
+		<field field="costamt" datatype="number" onlyusermode="0">
 			成本
 			金额
 		</field>
-		<field field="formula">
+		<field field="formula" onlyusermode="0">
 			金额文本
 			公式
 		</field>
-		<field field="replace_formula">
+		<field field="replace_formula" onlyusermode="0">
 			金额数字
 			公式
 		</field>
-		<field field="useqty" datatype="number">清单用量</field>
-		<field field="useformula">
+		<field field="useqty" datatype="number" onlyusermode="0">清单用量</field>
+		<field field="useformula" onlyusermode="0">
 			用量文本
 			公式
 		</field>
-		<field field="replace_useformula">
+		<field field="replace_useformula" onlyusermode="0">
 			用量数字
 			公式
 		</field>

+ 109 - 0
JLHHJSvr/DataStore/web_mattress_mx_bednet.xml

@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<select>
+	<selectstr>
+		SELECT
+		u_mattress_mx_mtrl.mattressmxid,
+		u_mattress_mx_mtrl.mattressid,
+		u_mattress_formula.formulakind as formulakind ,
+		u_mattress_mx_mtrl.formula as  formula,
+		u_mattress_mx_mtrl.formulaid,
+		u_mattress_mx_mtrl.mtrlid,
+		ISNULL(vv_bednet.bednetname, u_mattress_mx_mtrl.mtrlid) as bednetname,
+		u_mattress_mx_mtrl.price,
+		u_mattress_mx_mtrl.gram_weight,
+		u_mattress_mx_mtrl.cloth_width,
+		u_mattress_mx_mtrl.if_inputqty,
+		u_mattress_mx_mtrl.qty ,
+		u_mattress_mx_mtrl.costamt,
+		u_mattress_mx_mtrl.if_areaprice,
+		u_mattress_formula.formulatype,
+		u_mattress_formula.sortcode,
+		u_mattress_formula.if_mtrl,
+		u_mattress_mx_mtrl.if_success,
+		u_mattress_mx_mtrl.replace_formula,
+		u_mattress_mx_mtrl.priceunit,
+		u_mattress_mx_mtrl.shrinkage,
+		CASE when u_mattress_formula.if_mtrl > 1 THEN '+' ELSE '' END as addmx,
+		CASE when u_mattress_formula.if_mtrl > 1 THEN '-' ELSE '' END as delmx,
+		u_mtrl_price.name,
+		u_mattress_mx_mtrl.thickness,
+		u_mattress_mx_mtrl.chastr,
+		u_mattress_mx_mtrl.xu,
+		u_mattress_mx_mtrl.costamt as useqty,
+		u_mattress_mx_mtrl.useformula,
+		u_mattress_mx_mtrl.replace_useformula,
+		u_mattress_mx_mtrl.gydscrp
+
+
+		From u_mattress_mx_mtrl
+		Left join u_mattress_formula On u_mattress_formula.formulaid = u_mattress_mx_mtrl.formulaid left outer join u_mtrl_price on
+		u_mattress_mx_mtrl.mtrlid = u_mtrl_price.mtrlid
+
+		left outer join (
+		SELECT u_bednet.bednetid,
+		rtrim(u_bednet_type.typename)+ ' ' +  rtrim(u_bednet.bednetcode)+ ' '+cast(u_bednet.mattress_width as char(3))+ '*'
+		+cast(u_bednet.mattress_length as char(3))+ '*'+cast(u_bednet.mattress_height as char(3)) as bednetname
+
+		FROM u_bednet, u_bednet_type
+		) as vv_bednet ON vv_bednet.bednetid = u_mattress_mx_mtrl.mtrlid
+	</selectstr>
+	<where>
+		<when notnull="@arg_mattressid">
+			u_mattress_mx_mtrl.mattressid = @arg_mattressid
+		</when>
+		<when notnull="@arg_formulatype">
+			u_mattress_formula.formulatype = @arg_formulatype
+		</when>
+	</where>
+	<displayfields>
+		<field field="pid" compute="getrow()">序</field>
+		<field field="if_success" datatype="checkbox">
+			计算
+			成功?
+		</field>
+		<field field="addmx">+</field>
+		<field field="delmx">-</field>
+		<field field="formulakind" table="u_mattress_formula" mapper="" ddd="ddd_mattress_formula_formulakind">公式名</field>
+		<field field="if_mtrl" table="u_mattress_formula" datatype="checkbox">按物料?</field>
+		<field field="bednetname">物料</field>
+		<field field="qty" datatype="number">数量</field>
+		<field field="price" datatype="number">
+			物料
+			单价
+		</field>
+		<field field="priceunit">单位</field>
+		<field field="shrinkage" datatype="number">收缩率</field>
+		<field field="gram_weight" datatype="number">克重</field>
+		<field field="cloth_width" datatype="number">幅宽</field>
+		<field field="if_inputqty" datatype="checkbox">
+			厚度?
+			数量?
+		</field>
+		<field field="if_areaprice" datatype="checkbox">
+			按面积
+			单价?
+		</field>
+		<field field="costamt" datatype="number">
+			成本
+			金额
+		</field>
+		<field field="formula">
+			金额文本
+			公式
+		</field>
+		<field field="replace_formula">
+			金额数字
+			公式
+		</field>
+		<field field="useqty" datatype="number">清单用量</field>
+		<field field="useformula">
+			用量文本
+			公式
+		</field>
+		<field field="replace_useformula">
+			用量数字
+			公式
+		</field>
+		<field field="gydscrp">工艺填写说明</field>
+	</displayfields>
+</select>

+ 98 - 0
JLHHJSvr/DataStore/web_mattress_mx_dianceng.xml

@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<select>
+	<selectstr>
+		SELECT
+		u_mattress_mx_mtrl.mattressmxid,
+		u_mattress_mx_mtrl.mattressid,
+		u_mattress_formula.formulakind as formulakind ,
+		u_mattress_mx_mtrl.formula as  formula,
+		u_mattress_mx_mtrl.formulaid,
+		u_mattress_mx_mtrl.mtrlid,
+		u_mattress_mx_mtrl.price,
+		u_mattress_mx_mtrl.gram_weight,
+		u_mattress_mx_mtrl.cloth_width,
+		u_mattress_mx_mtrl.if_inputqty,
+		u_mattress_mx_mtrl.qty ,
+		u_mattress_mx_mtrl.costamt,
+		u_mattress_mx_mtrl.if_areaprice,
+		u_mattress_formula.formulatype,
+		case when u_mattress_mx_mtrl.chastr <> '' then  u_mattress_mx_mtrl.chastr  else u_mattress_formula.sortcode end  as  sortcode,
+		u_mattress_formula.if_mtrl,
+		u_mattress_mx_mtrl.if_success,
+		u_mattress_mx_mtrl.replace_formula,
+		u_mattress_mx_mtrl.priceunit,
+		u_mattress_mx_mtrl.shrinkage,
+		CASE when u_mattress_formula.if_mtrl > 1 THEN '+' ELSE '' END as addmx,
+		CASE when u_mattress_formula.if_mtrl > 1 THEN '-' ELSE '' END as delmx,
+		u_mtrl_price.name,
+		u_mattress_mx_mtrl.thickness,
+		u_mattress_mx_mtrl.chastr,
+		u_mattress_mx_mtrl.xu,
+		u_mattress_mx_mtrl.costamt as useqty,
+		u_mattress_mx_mtrl.useformula,
+		u_mattress_mx_mtrl.replace_useformula,
+		u_mattress_mx_mtrl.gydscrp
+
+		From u_mattress_mx_mtrl
+		Left join u_mattress_formula On u_mattress_formula.formulaid = u_mattress_mx_mtrl.formulaid left outer join u_mtrl_price on
+		u_mattress_mx_mtrl.mtrlid = u_mtrl_price.mtrlid
+	</selectstr>
+	<where>
+		<when notnull="@arg_mattressid">
+			u_mattress_mx_mtrl.mattressid = @arg_mattressid
+		</when>
+		<when notnull="@arg_formulatype">
+			u_mattress_formula.formulatype = @arg_formulatype
+		</when>
+	</where>
+	<displayfields>
+		<field field="pid" compute="getrow()">序</field>
+		<field field="if_success" datatype="checkbox">
+			计算
+			成功?
+		</field>
+		<field field="formulakind" table="u_mattress_formula" mapper="" ddd="ddd_mattress_formula_formulakind_dc">公式名</field>
+		<field field="chastr" mapper="u_mattress_mx_mtrl.dianceng_area" ddd="dddw_dianceng_area">位置</field>
+		<field field="thickness" datatype="number">厚度cm</field>
+		<field field="mtrlid" mapper="u_mattress_mx_mtrl.mtrl_price" ddd="ddd_mtrl_price">物料</field>
+		<field field="qty" datatype="number">数量</field>
+		<field field="price" datatype="number">
+			物料
+			单价
+		</field>
+		<field field="priceunit">单位</field>
+		<field field="shrinkage" datatype="number">收缩率</field>
+		<field field="gram_weight" datatype="number">克重</field>
+		<field field="cloth_width" datatype="number">幅宽</field>
+		<field field="if_inputqty" datatype="checkbox">
+			固定
+			厚度?
+		</field>
+		<field field="if_areaprice" datatype="checkbox">
+			按面积
+			单价?
+		</field>
+		<field field="costamt" datatype="number">
+			成本
+			金额
+		</field>
+		<field field="formula">
+			金额文本
+			公式
+		</field>
+		<field field="replace_formula">
+			金额数字
+			公式
+		</field>
+		<field field="useqty" datatype="number">清单用量</field>
+		<field field="useformula">
+			用量文本
+			公式
+		</field>
+		<field field="replace_useformula">
+			用量数字
+			公式
+		</field>
+		<field field="gydscrp">工艺填写说明</field>
+	</displayfields>
+</select>

+ 112 - 0
JLHHJSvr/DataStore/web_mattress_mx_neibutao.xml

@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<select>
+	<selectstr>
+		SELECT
+			u_mattress_mx_mtrl.mattressmxid,
+			u_mattress_mx_mtrl.mattressid,
+			u_mattress_formula.formulakind as formulakind ,
+			u_mattress_mx_mtrl.formula as  formula,
+			u_mattress_mx_mtrl.formulaid,
+			u_mattress_mx_mtrl.mtrlid,
+			vv_mtrl_price.mtrlname,
+			u_mattress_mx_mtrl.price,
+			u_mattress_mx_mtrl.gram_weight,
+			u_mattress_mx_mtrl.cloth_width,
+			u_mattress_mx_mtrl.if_inputqty,
+			u_mattress_mx_mtrl.qty ,
+			u_mattress_mx_mtrl.costamt,
+			u_mattress_mx_mtrl.if_areaprice,
+			u_mattress_formula.formulatype,
+			case when u_mattress_mx_mtrl.chastr <> '' then  u_mattress_mx_mtrl.chastr  else u_mattress_formula.sortcode end  as  sortcode,
+			u_mattress_formula.if_mtrl,
+			u_mattress_mx_mtrl.if_success,
+			u_mattress_mx_mtrl.replace_formula,
+			u_mattress_mx_mtrl.priceunit,
+			u_mattress_mx_mtrl.shrinkage,
+			CASE when u_mattress_formula.if_mtrl > 1 THEN '+' ELSE '' END as addmx,
+			CASE when u_mattress_formula.if_mtrl > 1 THEN '-' ELSE '' END as delmx,
+			u_mtrl_price.name,
+			u_mattress_mx_mtrl.thickness,
+			u_mattress_mx_mtrl.chastr,
+			u_mattress_mx_mtrl.xu,
+			u_mattress_mx_mtrl.costamt as useqty,
+			u_mattress_mx_mtrl.useformula,
+			u_mattress_mx_mtrl.replace_useformula ,
+			u_mattress_mx_mtrl.gydscrp
+		From u_mattress_mx_mtrl
+		Left JOIN u_mattress_formula On u_mattress_formula.formulaid = u_mattress_mx_mtrl.formulaid left outer join u_mtrl_price on
+			u_mattress_mx_mtrl.mtrlid = u_mtrl_price.mtrlid
+		Left OUTER JOIN (
+			select
+				mtrlid,
+				name as mtrlname
+			from u_mtrl_price
+			union all
+				select top 1
+				0 as mtrlid,
+				' ' as mtrlname
+				from u_user_jlhprice
+		) AS vv_mtrl_price on vv_mtrl_price.mtrlid = u_mattress_mx_mtrl.mtrlid
+	</selectstr>
+	<where>
+		<when notnull="@arg_mattressid">
+			u_mattress_mx_mtrl.mattressid = @arg_mattressid
+		</when>
+		<when notnull="@@arg_formulatype@@">
+			u_mattress_formula.formulatype in (@@arg_formulatype@@)
+		</when>
+	</where>
+	<displayfields>
+		<field field="pid" compute="getrow()">序</field>
+		<field field="if_success" datatype="checkbox" onlyusermode="0">
+			计算
+			成功?
+		</field>
+		<field field="addmx">+</field>
+		<field field="delmx">-</field>
+		<field field="chastr" datatype="checkbox">位置</field>
+		<field field="formulakind" table="u_mattress_formula" mapper="" ddd="ddd_mattress_formula_formulakind">公式名</field>
+		<field field="if_mtrl" table="u_mattress_formula" datatype="checkbox">按物料?</field>
+		<field field="thickness" datatype="number">厚度cm/条数</field>
+		<field field="mtrlname">物料</field>
+		<field field="qty" datatype="number">数量/长度</field>
+		<field field="price" datatype="number" onlyusermode="0">
+			物料
+			单价
+		</field>
+		<field field="priceunit">单位</field>
+		<field field="shrinkage" onlyusermode="0" datatype="number">收缩率</field>
+		<field field="gram_weight" datatype="number" onlyusermode="0">克重</field>
+		<field field="cloth_width" datatype="number" onlyusermode="0">幅宽</field>
+		<field field="if_inputqty" datatype="checkbox" onlyusermode="0">
+			固定
+			厚度?
+		</field>
+		<field field="if_areaprice" datatype="checkbox" onlyusermode="0">
+			按面积
+			单价?
+		</field>
+		<field field="costamt" datatype="number" onlyusermode="0">
+			成本
+			金额
+		</field>
+		<field field="formula" onlyusermode="0">
+			金额文本
+			公式
+		</field>
+		<field field="replace_formula" onlyusermode="0">
+			金额数字
+			公式
+		</field>
+		<field field="useqty" datatype="number" onlyusermode="0">清单用量</field>
+		<field field="useformula" onlyusermode="0">
+			用量文本
+			公式
+		</field>
+		<field field="replace_useformula" onlyusermode="0">
+			用量数字
+			公式
+		</field>
+		<field field="gydscrp">工艺填写说明</field>
+	</displayfields>
+</select>

+ 99 - 0
JLHHJSvr/DataStore/web_mattress_mx_no.xml

@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<select>
+	<selectstr>
+		SELECT
+		u_mattress_mx_mtrl.mattressmxid,
+		u_mattress_mx_mtrl.mattressid,
+		u_mattress_formula.formulakind as formulakind ,
+		u_mattress_mx_mtrl.formula as  formula,
+		u_mattress_mx_mtrl.formulaid,
+		u_mattress_mx_mtrl.mtrlid,
+		u_mattress_mx_mtrl.price,
+		u_mattress_mx_mtrl.gram_weight,
+		u_mattress_mx_mtrl.cloth_width,
+		u_mattress_mx_mtrl.if_inputqty,
+		u_mattress_mx_mtrl.qty ,
+		u_mattress_mx_mtrl.costamt,
+		u_mattress_mx_mtrl.if_areaprice,
+		u_mattress_formula.formulatype,
+		u_mattress_formula.sortcode,
+		u_mattress_formula.if_mtrl,
+		u_mattress_mx_mtrl.if_success,
+		u_mattress_mx_mtrl.replace_formula,
+		u_mattress_mx_mtrl.priceunit,
+		u_mattress_mx_mtrl.shrinkage,
+		CASE when u_mattress_formula.if_mtrl > 1 THEN '+' ELSE '' END as addmx,
+		CASE when u_mattress_formula.if_mtrl > 1 THEN '-' ELSE '' END as delmx,
+		u_mtrl_price.name,
+		u_mattress_mx_mtrl.thickness,
+		u_mattress_mx_mtrl.chastr,
+		u_mattress_mx_mtrl.xu,
+		u_mattress_mx_mtrl.costamt as useqty,
+		u_mattress_mx_mtrl.useformula,
+		u_mattress_mx_mtrl.replace_useformula,
+		u_mattress_mx_mtrl.gydscrp
+
+		From u_mattress_mx_mtrl
+		Left join u_mattress_formula On u_mattress_formula.formulaid = u_mattress_mx_mtrl.formulaid left outer join u_mtrl_price on
+		u_mattress_mx_mtrl.mtrlid = u_mtrl_price.mtrlid
+	</selectstr>
+	<where>
+		<when notnull="@arg_mattressid">
+			u_mattress_mx_mtrl.mattressid = @arg_mattressid
+		</when>
+		<when notnull="@arg_formulatype">
+			u_mattress_formula.formulatype = @arg_formulatype
+		</when>
+	</where>
+	<displayfields>
+		<field field="pid" compute="getrow()">序</field>
+		<field field="if_success" datatype="checkbox">
+			计算
+			成功?
+		</field>
+		<field field="addmx">+</field>
+		<field field="delmx">-</field>
+		<field field="formulakind" table="u_mattress_formula" mapper="" ddd="ddd_mattress_formula_formulakind">公式名</field>
+		<field field="if_mtrl" table="u_mattress_formula" datatype="checkbox">按物料?</field>
+		<field field="mtrlid" mapper="u_mattress_mx_mtrl.mtrl_price" ddd="ddd_mtrl_price">物料</field>
+		<field field="qty" datatype="number">数量</field>
+		<field field="price" datatype="number">
+			物料
+			单价
+		</field>
+		<field field="priceunit">单位</field>
+		<field field="shrinkage" datatype="number">收缩率</field>
+		<field field="gram_weight" datatype="number">克重</field>
+		<field field="cloth_width" datatype="number">幅宽</field>
+		<field field="if_inputqty" datatype="checkbox">
+			固定
+			厚度?
+		</field>
+		<field field="if_areaprice" datatype="checkbox">
+			按面积
+			单价?
+		</field>
+		<field field="costamt" datatype="number">
+			成本
+			金额
+		</field>
+		<field field="formula">
+			金额文本
+			公式
+		</field>
+		<field field="replace_formula">
+			金额数字
+			公式
+		</field>
+		<field field="useqty" datatype="number">清单用量</field>
+		<field field="useformula">
+			用量文本
+			公式
+		</field>
+		<field field="replace_useformula">
+			用量数字
+			公式
+		</field>
+		<field field="gydscrp">工艺填写说明</field>
+	</displayfields>
+</select>

+ 3 - 0
JLHHJSvr/DataStore/web_mattress_typelist.xml

@@ -29,6 +29,9 @@ SELECT mattresstypeid
 FROM u_mattress_type
   </selectstr>
   <where>
+	  <when notnull="@arg_mattresstypeid">
+		  u_mattress_type.mattresstypeid = @arg_mattresstypeid
+	  </when>
   </where>
   <orderstr>
   </orderstr>

+ 69 - 0
JLHHJSvr/DataStore/web_mtrl_choose.xml

@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<select>
+	<selectstr>
+		SELECT
+		u_mtrl_price.mtrlid,
+		u_mtrl_price.mtrltype,
+		u_mtrl_price.name AS mtrlname,
+		u_mtrl_price.priceunit,
+		u_mtrl_price.shrinkage AS price,
+		u_mtrl_price.gram_weight,
+		u_mtrl_price.cloth_width,
+		u_mtrl_price.if_inputqty,
+		u_mtrl_price.if_areaprice,
+		u_mtrl_price.thickness,
+		u_mtrl_price.dscrp,
+		u_mtrl_price.createtime,
+		u_mtrl_price.createby,
+		ISNULL(u_mtrl_price_pricelist.price, 0) AS pricelistprice,
+		ISNULL(u_mtrl_price_pricelist.price_formula, '') AS price_formula,
+		u_mtrl_price.erp_mtrlid,
+		SPACE(200) AS erp_mtrlcode,
+		SPACE(200) AS erp_mtrlname,
+		SPACE(200) AS erp_mtrlmode,
+		SPACE(200) AS erp_unit,
+		SPACE(200) AS erp_mtrlengname,
+		ISNULL(u_mattress_formula.formulaid,0) AS formulaid
+		FROM u_mtrl_price
+		LEFT JOIN u_mtrl_price_pricelist ON u_mtrl_price.mtrlid = u_mtrl_price_pricelist.mtrlid
+		LEFT OUTER JOIN u_mattress_formula ON u_mattress_formula.default_mtrlid = u_mtrl_price.mtrlid
+	</selectstr>
+	<where>
+		<when notnull="@keyword">
+			u_mtrl_price.name like '%'+ @keyword + '%' OR u_mtrl_price.dscrp like '%'+ @keyword + '%' OR u_mtrl_price.mtrlid like '%'+ @keyword + '%'
+		</when>
+		<when>
+			u_mtrl_price.isuse = 1
+		</when>
+		<when>
+			u_mtrl_price.lastdate >= GETDATE()
+		</when>
+		<when notnull="@arg_mtrltype">
+			u_mtrl_price.mtrltype = @arg_mtrltype 
+			OR ( @arg_mtrltype = 200 AND u_mtrl_price.mtrlid IN (8727, 8728, 47414) )
+		</when>
+		<when notnull="@arg_pricelistid">
+			u_mtrl_price_pricelist.pricelistid = @arg_pricelistid
+			OR u_mtrl_price.mtrlid NOT IN (SELECT mtrlid FROM u_mtrl_price_pricelist WHERE pricelistid = @arg_pricelistid)
+		</when>
+		<when notnull="@arg_mtrlid">
+			u_mtrl_price.mtrlid = @arg_mtrlid 
+		</when>
+		<when notempty="@@arg_array_formulaid@@">
+			u_mattress_formula.formulaid IN (@@arg_array_formulaid@@) OR u_mtrl_price.mtrlid IN (@@arg_array_mtrlid@@)
+		</when>
+	</where>
+	<displayfields>
+		<field field="pid" compute="getrow()">序</field>
+		<field field="mtrlname">名称</field>
+		<field field="thickness">厚度</field>
+		<field field="priceunit">单位</field>
+		<field field="pricelistprice" funcid="96">单价</field>
+		<field field="dscrp" table="u_mtrl_price">备注</field>
+		<field field="erp_mtrlcode">L1编码</field>
+		<field field="erp_mtrlname">L1名称</field>
+		<field field="erp_mtrlmode">L1规格</field>
+		<field field="erp_unit">L1单位</field>
+		<field field="erp_mtrlengname">L1英文名称</field>
+	</displayfields>
+</select>

+ 14 - 6
JLHHJSvr/Excutor/CommonDynamicSelectExcutor.cs

@@ -674,7 +674,7 @@ namespace JLHHJSvr.Excutor
                         throw new LJCommonException("语法错误:" + field + ":" + title + ",输出项无法匹配对应sql数据");
                     }
                     col.Add("title", title);
-                    handleCustomTitle(cmd, tokendata.userid, col, dbField);
+                    handleCustomTitle(cmd, tokendata, col, dbField);
                     if (!string.IsNullOrEmpty(field) && oldcolDic.ContainsKey(field))
                     {
                         var oldInfo = oldcolDic[field];
@@ -755,7 +755,7 @@ namespace JLHHJSvr.Excutor
             }
             return rslt;
         }
-        private void handleCustomTitle(SqlCommand cmd, int empid, JObject col, string dbfield)
+        private void handleCustomTitle(SqlCommand cmd, TokenData tokenData, JObject col, string dbfield)
         {
             var field = col.GetValue("field")?.ToString();
             var title = col.GetValue("title")?.ToString();
@@ -873,7 +873,7 @@ namespace JLHHJSvr.Excutor
                 col["title"] = custitle;
             }
             //处理显示权限
-            /*if (!col.ContainsKey("funcid"))
+            if (!col.ContainsKey("funcid"))
             {
                 if (dbfield.Contains("u_spt.name") || dbfield.Contains("sptname"))
                 {
@@ -886,7 +886,7 @@ namespace JLHHJSvr.Excutor
             if (col.ContainsKey("funcid"))
             {
                 var funcid = Convert.ToInt32(col.GetValue("funcid").ToString());
-                if (!FuncPowerHelper.CheckFuncPower(cmd, empid, funcid))
+                if (!FuncPowerHelper.CheckFuncPower(cmd, tokenData.userid, funcid))
                 {
                     visibleLimited = true;
                 }
@@ -894,11 +894,19 @@ namespace JLHHJSvr.Excutor
             if (col.ContainsKey("funcid_notequals"))
             {
                 var funcid = Convert.ToInt32(col.GetValue("funcid_notequals").ToString());
-                if (!FuncPowerHelper.CheckFuncPower(cmd, empid, funcid))
+                if (FuncPowerHelper.CheckFuncPower(cmd, tokenData.userid, funcid))
                 {
                     visibleLimited = true;
                 }
-            }*/
+            }
+            if (col.ContainsKey("onlyusermode"))
+            {
+                var usermode = Convert.ToInt32(col.GetValue("onlyusermode").ToString());
+                if (tokenData.usermode != usermode)
+                {
+                    visibleLimited = true;
+                }
+            }
             if (visibleLimited)
             {
                 col.Add("limited", true);

+ 46 - 0
JLHHJSvr/Excutor/GetFormulaComputeExcutor.cs

@@ -0,0 +1,46 @@
+using System;
+using System.Collections.Generic;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Text;
+using JLHHJSvr.BLL;
+using JLHHJSvr.Com;
+using JLHHJSvr.Com.Model;
+using JLHHJSvr.DBA.DBModle;
+using JLHHJSvr.LJFramework.Tools;
+using LJLib.DAL.SQL;
+using LJLib.Net.SPI.Server;
+
+namespace JLHHJSvr.Excutor
+{
+    internal sealed class GetFormulaComputeExcutor : ExcutorBase<GetFormulaComputeRequest, GetFormulaComputeResponse>
+    {
+        protected override void ExcuteInternal(GetFormulaComputeRequest request, object state, GetFormulaComputeResponse rslt)
+        {
+            var tokendata = BllHelper.GetToken(request.token);
+            if (tokendata == null)
+            {
+                rslt.ErrMsg = "会话已经中断,请重新登录";
+                return;
+            }
+            using (var con = new SqlConnection(GlobalVar.ConnectionString))
+            using (var cmd = con.CreateCommand())
+            {
+                con.Open();
+
+                rslt.values = new List<decimal>();
+                try {
+                    foreach(var iformula in request.formulas)
+                    {
+                        var res = LJExprParser.Parse(iformula);
+                        rslt.values.Add(res.Result.DecimalValue);
+                    }
+                }
+                catch (Exception ex)
+                {
+                    rslt.ErrMsg = ex.ToString();
+                }
+            }
+        }
+    }
+}

+ 5 - 3
JLHHJSvr/Excutor/LoginExcutor.cs

@@ -38,7 +38,7 @@ namespace JLHHJSvr.Excutor
 
                 if (DbSqlHelper.SelectOne(cmd, "u_user_jlhprice", "userid = @usercode",
                     new Dictionary<string, object>() {{"@usercode", request.usercode}}, stUser,
-                    "userid, empid, username, psw") != 1)
+                    "userid, empid, username, usermode, psw") != 1)
                 {
                     rslt.ErrMsg = "用户名不存在或密码错误";
                     return;
@@ -59,12 +59,14 @@ namespace JLHHJSvr.Excutor
             rslt.username = stUser.username;
             rslt.usercode = stUser.userid;
             rslt.empid = stUser.empid;
+            rslt.usermode = stUser.usermode;
             var tokenData = new TokenData
             {
                 usercode = stUser.userid,
                 userid = stUser.empid,
-                username = stUser.username
-            };
+                username = stUser.username,
+                usermode = stUser.usermode
+        };
             BllHelper.SetToken(token,tokenData);
         }
     }

+ 101 - 0
JLHHJSvr/Excutor/SaveMattressExcutor.cs

@@ -0,0 +1,101 @@
+using System;
+using System.Collections.Generic;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Text;
+using JLHHJSvr.BLL;
+using JLHHJSvr.Com;
+using JLHHJSvr.Com.Model;
+using JLHHJSvr.LJException;
+using JLHHJSvr.Tools;
+using LJLib.DAL.SQL;
+using LJLib.Net.SPI.Server;
+
+namespace JLHHJSvr.Excutor
+{
+    internal sealed class SaveMattressExcutor : ExcutorBase<SaveMattressRequest, SaveMattressResponse>
+    {
+        protected override void ExcuteInternal(SaveMattressRequest request, object state, SaveMattressResponse rslt)
+        {
+            var tokendata = BllHelper.GetToken(request.token);
+            if (tokendata == null)
+            {
+                rslt.ErrMsg = "会话已经中断,请重新登录";
+                return;
+            }
+            if (request.mattress == null)
+            {
+                rslt.ErrMsg = "缺少主表信息";
+                return;
+            }
+
+            using (var con = new SqlConnection(GlobalVar.ConnectionString))
+            using (var cmd = con.CreateCommand())
+            {
+                con.Open();
+
+                // 初始化属性
+                //AutoInit.AutoInitS(cmd, request.mattress);
+
+                using (cmd.Transaction = con.BeginTransaction())
+                {
+                    try
+                    {
+                        var dtNow = DateTime.Now;
+
+                        var fieldsMx = "mattressmxid,mattressid,formulaid,formula,replace_formula,if_success,priceunit,shrinkage,mtrlid,price,gram_weight,cloth_width,if_inputqty,qty ,costamt,if_areaprice,thickness,chastr,xu,useqty,useformula,replace_useformula,gydscrp";
+                        var currentMattressID = request.mattress.mattressid;
+
+                        if (request.mattress.mattressid == null || request.mattress.mattressid <= 0)
+                        {
+                            //新建
+                            request.mattress.createtime = dtNow;
+                            request.mattress.mattressid = BllHelper.GetID(cmd, "u_mattress");
+                            currentMattressID = request.mattress.mattressid;
+
+                            //var fields = "deptid,deptname,profitrate,pricelistid,springtypeid,createtime,moneyrate,discount,flag,if_rate_auto,manage_amt,mtrltype";
+                            //DbSqlHelper.Insert(cmd, "u_mattress", null, request.mattress, fields);
+                        }
+                        else
+                        {
+                            //修改
+                            //request.mattress.moddate = dtNow;
+                            //request.mattress.modemp = tokendata.username;
+
+                            //var fields = "deptname,profitrate,pricelistid,springtypeid,moneyrate,discount,flag,if_rate_auto,manage_amt,mtrltype,moddate,modemp";
+                            //DbSqlHelper.Update(cmd, "u_mattress", null, request.mattress, "deptid", fields);
+
+                            //var oriMx = new u_mattress_mx_mtrl {
+                            //    mattressid = request.mattress.mattressid
+                            //};
+                            //DbSqlHelper.Delete(cmd, oriMx);
+                        }
+
+                        if (request.mianliao != null && request.mianliao.Count > 0)
+                        {
+                            foreach (var item in request.mianliao)
+                            {
+                                item.mattressid = currentMattressID;
+                                if (item.mattressmxid <= 0)
+                                {
+                                    item.mattressmxid = BllHelper.GetID(cmd, "u_mattress_mx_mtrl");
+                                }
+                            }
+
+                            //DbSqlHelper.Insert(cmd, "u_mattress_mx_mtrl", null, request.mianliao, fieldsMx);
+                        }
+
+                        //...
+
+                        cmd.Transaction.Commit();
+                    }
+                    catch (Exception e)
+                    {
+                        cmd.Transaction.Rollback();
+                        rslt.ErrMsg = e.ToString();
+                    }
+                }
+            }
+        }
+    }
+}

+ 5 - 0
JLHHJSvr/GlobalVar/GlobalVar.cs

@@ -142,6 +142,11 @@ namespace JLHHJSvr
                 excutorManager.AddMap("SaveMtrlDef", typeof(SaveMtrlDefRequest), new SaveMtrlDefExcutor());// 获取物料类型
                 excutorManager.AddMap("DeleteMtrlDef", typeof(DeleteMtrlDefRequest), new DeleteMtrlDefExcutor());// 获取物料类型
                 excutorManager.AddMap("BanMtrlDef", typeof(BanMtrlDefRequest), new BanMtrlDefExcutor());// 获取物料类型
+
+
+                excutorManager.AddMap("GetFormulaCompute", typeof(GetFormulaComputeRequest), new GetFormulaComputeExcutor());// 公式计算
+
+                excutorManager.AddMap("SaveMattress", typeof(SaveMattressRequest), new SaveMattressExcutor());// 保存床垫报价
             }
             catch (Exception ex)
             {

+ 14 - 0
JLHHJSvr/JLHHJSvr.csproj

@@ -51,8 +51,12 @@
     <Reference Include="System.Drawing" />
     <Reference Include="System.Windows.Forms" />
     <Reference Include="System.Xml" />
+    <Reference Include="TExprParser">
+      <HintPath>..\..\..\L1-server\L1-OA_Server\L1Net\DLLs\TExprParser.dll</HintPath>
+    </Reference>
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="BLL\FuncPowerHelper.cs" />
     <Compile Include="BLL\UserHelper.cs" />
     <Compile Include="BLL\BllHelper.cs" />
     <Compile Include="BLL\TokenData.cs" />
@@ -89,6 +93,7 @@
     <Compile Include="Com\GetMtrlTypeList.cs" />
     <Compile Include="Com\GetPriceList.cs" />
     <Compile Include="Com\GetSysFuncPwr.cs" />
+    <Compile Include="Com\GetFormulaCompute.cs" />
     <Compile Include="Com\Model\Recursion.cs" />
     <Compile Include="Com\Model\sys_func_pwr.cs" />
     <Compile Include="Com\Model\u_bednet_type.cs" />
@@ -96,6 +101,9 @@
     <Compile Include="Com\Model\u_bednet_varmx.cs" />
     <Compile Include="Com\Model\u_dept.cs" />
     <Compile Include="Com\Model\u_factory_profitrate.cs" />
+    <Compile Include="Com\Model\u_mattress_mx_mtrl.cs" />
+    <Compile Include="Com\Model\u_mtrl_price.cs" />
+    <Compile Include="Com\Model\u_mattress.cs" />
     <Compile Include="Com\Model\u_mattress_formula.cs" />
     <Compile Include="Com\Model\u_mattress_type.cs" />
     <Compile Include="Com\Model\u_mtrltype.cs" />
@@ -105,8 +113,11 @@
     <Compile Include="Com\Model\u_spring.cs" />
     <Compile Include="Com\Model\u_workmanship_add.cs" />
     <Compile Include="Com\SaveBedNetType.cs" />
+    <Compile Include="Com\Model\u_workmanship_add.cs" />
+    <Compile Include="Com\SaveBedNetType.cs" />
     <Compile Include="Com\SaveBedNetVar.cs" />
     <Compile Include="Com\SaveDept.cs" />
+    <Compile Include="Com\SaveMattress.cs" />
     <Compile Include="Com\SaveMattressFormula.cs" />
     <Compile Include="Com\SaveMattressType.cs" />
     <Compile Include="Com\SaveMtrlDef.cs" />
@@ -196,6 +207,7 @@
     <Compile Include="Excutor\GetRoadListExcutor.cs" />
     <Compile Include="Excutor\GetPriceListExcutor.cs" />
     <Compile Include="Excutor\GetSysFuncPwrExcutor.cs" />
+    <Compile Include="Excutor\GetFormulaComputeExcutor.cs" />
     <Compile Include="Excutor\GetUserListExcutor.cs" />
     <Compile Include="Excutor\GetUserPowerExcutor.cs" />
     <Compile Include="Excutor\HelloWordExcutor.cs" />
@@ -211,6 +223,7 @@
     <Compile Include="Excutor\SaveMtrlDefExcutor.cs" />
     <Compile Include="Excutor\SaveMtrlTypeExcutor.cs" />
     <Compile Include="Excutor\SavePermitListExcutor.cs" />
+    <Compile Include="Excutor\SaveMattressExcutor.cs" />
     <Compile Include="Excutor\SaveProfitrateExcutor.cs" />
     <Compile Include="Excutor\SaveRoadListExcutor.cs" />
     <Compile Include="Excutor\SaveShrinkageExcutor.cs" />
@@ -224,6 +237,7 @@
     <Compile Include="ImgHelper\ImgHelper.cs" />
     <Compile Include="LJFrameWork\LJException\LJException.cs" />
     <Compile Include="LJFrameWork\LJLib.Method\SortedListEx.cs" />
+    <Compile Include="LJFrameWork\Tools\LJExprParser.cs" />
     <Compile Include="LJLib.HttpServer\IFileDBModel.cs" />
     <Compile Include="LJLib.HttpServer\SimpleHttpServer.cs" />
     <Compile Include="LJLib.HttpServer\LJHttpProcessor.cs" />

+ 119 - 0
JLHHJSvr/LJFrameWork/Tools/LJExprParser.cs

@@ -0,0 +1,119 @@
+using CSUST.Data.Expr;
+using JLHHJSvr.LJException;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+
+namespace JLHHJSvr.LJFramework.Tools
+{
+    public class LJExprParser
+    {
+        public static TExprParserEx Parse(string expr)
+        {
+            if (string.IsNullOrEmpty(expr)) return new TExprParserChina("");
+            var treatedExpr = expr;
+            treatedExpr = treatedExpr.Replace("不包含", " not like ");
+            treatedExpr = treatedExpr.Replace("包含", " like ");
+            treatedExpr = treatedExpr.Replace("不等于", " != ");
+            treatedExpr = treatedExpr.Replace("等于", " == ");
+            treatedExpr = treatedExpr.Replace("大于", " > ");
+            treatedExpr = treatedExpr.Replace("小于", " < ");
+            treatedExpr = treatedExpr.Replace("<>", " != ");
+            treatedExpr = treatedExpr.Replace("'%", "'");
+            treatedExpr = treatedExpr.Replace("%'", "'");
+            //treatedExpr = treatedExpr.Replace(" and ", " && ");
+            //treatedExpr = treatedExpr.Replace(" or ", " || ");
+            //treatedExpr = treatedExpr.Replace(" = ", " == ");
+            treatedExpr = Regex.Replace(treatedExpr, "([ ]|[\\w])([=])([^=])", "$1==$3");
+            treatedExpr = Regex.Replace(treatedExpr, "if(\\s*)[(]", "iif(");
+            treatedExpr = ConvertNotLikeExpression(treatedExpr);
+            treatedExpr = ConvertLikeExpression(treatedExpr);
+            treatedExpr = ConvertPosExpression(treatedExpr);
+            treatedExpr = ConvertInExpression(treatedExpr);
+            var rslt = new TExprParserChina(treatedExpr);
+            if (rslt.HasError)
+            {
+                throw new LJCommonException($"解析表达式{expr}失败:" + rslt.ErrorMessage);
+            }
+            return rslt;
+        }
+        public static string ConvertInExpression(string expression)
+        {
+            string pattern = "";
+            string replacement = "";
+            string convertedExpression = expression;
+            // 字符串in,单引号用占位符代替,数组转为字符串对比,移除所有空格
+            pattern = @"('[^']*')\s+not\s+in\s+\(([^)]*)\)";
+            convertedExpression = Regex.Replace(convertedExpression, pattern, match =>
+            {
+                var group1 = match.Groups[1].Value.Replace(" ", "").Replace("'", "quote");
+                var group2 = match.Groups[2].Value.Replace(" ", "").Replace("'", "quote");
+                return $"!HasStr(',{group2},',',{group1},')";
+            });
+            pattern = @"('[^']*')\s+in\s+\(([^)]*)\)";
+            convertedExpression = Regex.Replace(convertedExpression, pattern, match =>
+            {
+                var group1 = match.Groups[1].Value.Replace(" ", "").Replace("'", "quote");
+                var group2 = match.Groups[2].Value.Replace(" ", "").Replace("'", "quote");
+                return $"HasStr(',{group2},',',{group1},')";
+            });
+
+            // 数字in,数组转为字符串对比,移除所有空格
+            pattern = @"(\d*)\s+not\s+in\s+\(([^)]*)\)";
+            convertedExpression = Regex.Replace(convertedExpression, pattern, match =>
+            {
+                var group1 = match.Groups[1].Value.Replace(" ", "");
+                var group2 = match.Groups[2].Value.Replace(" ", "");
+                return $"!HasStr(',{group2},',',{group1},')";
+            });
+            pattern = @"(\d*)\s+in\s+\(([^)]*)\)";
+            convertedExpression = Regex.Replace(convertedExpression, pattern, match =>
+            {
+                var group1 = match.Groups[1].Value.Replace(" ", "");
+                var group2 = match.Groups[2].Value.Replace(" ", "");
+                return $"HasStr(',{group2},',',{group1},')";
+            });
+
+            return convertedExpression;
+        }
+        public static string ConvertNotLikeExpression(string expression)
+        {
+            string pattern = @"'([^']*)'\s+not\s+like\s+'([^']*)'";
+            string replacement = "!HasStr('$1', '$2')";
+
+            string convertedExpression = Regex.Replace(expression, pattern, replacement);
+
+            return convertedExpression;
+        }
+        public static string ConvertLikeExpression(string expression)
+        {
+            string pattern = @"'([^']*)'\s+like\s+'([^']*)'";
+            string replacement = "HasStr('$1', '$2')";
+
+            string convertedExpression = Regex.Replace(expression, pattern, replacement);
+
+            return convertedExpression;
+        }
+        public static string ConvertPosExpression(string expression)
+        {
+            var reg = new Regex(@"pos[(](\s*)'([^']*)'(\s*),(\s*)'([^']*)'(\s*)[)]");
+            var rslt = expression;
+            while (true)
+            {
+                var match = reg.Match(rslt);
+                if (!match.Success)
+                {
+                    break;
+                }
+                var p1 = match.Groups[2].Value;
+                var p2 = match.Groups[5].Value;
+                var calVal = p1.IndexOf(p2) + 1;
+                rslt = rslt.Replace(match.Value, calVal.ToString());
+            }
+            return rslt;
+        }    
+    }
+}