SoftBedHelper.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547
  1. using DirectService.Tools;
  2. using JLHHJSvr.BLL;
  3. using JLHHJSvr.Com.Model;
  4. using JLHHJSvr.LJException;
  5. using JLHHJSvr.Tools;
  6. using LJLib.DAL.SQL;
  7. using NPOI.SS.Formula.Functions;
  8. using System;
  9. using System.Collections;
  10. using System.Collections.Generic;
  11. using System.Linq;
  12. using System.Text;
  13. using System.Threading.Tasks;
  14. using System.Web;
  15. using static JLHHJSvr.Helper.CacheHelper;
  16. namespace JLHHJSvr.Helper
  17. {
  18. internal class SoftBedHelper : HelperBase
  19. {
  20. /// <summary>
  21. /// 获取软床报价单据
  22. /// </summary>
  23. /// <param name="billid"></param>
  24. /// <param name="fields"></param>
  25. /// <param name="bill"></param>
  26. public u_softbed GetSoftBed(int billid,string fields = null)
  27. {
  28. fields = fields ?? @"softbed_id,softbed_code,softbed_relcode,softbed_name,deptid,create_date,create_emp,mtrlmode,mtrltype,has_headboard,has_nightstand,has_bedframe,is_template,
  29. template_id,template_code,template_name,commission,taxes,taxrate,other_rate,extras_cost,money_type,moneyrate,dscrp,costamt,nottax_factory_cost,nottax_dept_cost,
  30. dept_cost,foreign_cost";
  31. var bill = new u_softbed() { softbed_id = billid };
  32. if (DbSqlHelper.SelectOne(cmd, bill, fields) == 0) return null;
  33. return bill;
  34. }
  35. /// <summary>
  36. /// 获取软床报价单据明细
  37. /// </summary>
  38. /// <param name="billid"></param>
  39. /// <param name="fields"></param>
  40. /// <param name="mxlist"></param>
  41. public void GetSoftBedMxList(int billid,string fields,out List<u_softbed_mx> mxlist,out List<u_configure_codemx> codeList)
  42. {
  43. fields = fields ?? @"softbed_id,printid,pzid,pz_printid,mtrlid,mtrlname,mtrlcode,mtrlmode,unit,has_type,allow_edit,cutting_length,cutting_width,cutting_qty,
  44. useqty,use_formula,use_formula_str,actual_useqty,loss_rate,price,price_formula,price_formula_str,cost_price,cost_amt,pzname,pzmxname";
  45. mxlist = new List<u_softbed_mx>();
  46. var selectStr = @"SELECT u_softbed_mx.softbed_id
  47. ,u_softbed_mx.printid
  48. ,u_softbed_mx.pzid
  49. ,u_softbed_mx.pz_printid
  50. ,u_softbed_mx.mtrlid
  51. ,u_softbed_mx.mtrlname
  52. ,u_softbed_mx.mtrlcode
  53. ,u_softbed_mx.mtrlmode
  54. ,u_softbed_mx.unit
  55. ,u_softbed_mx.has_type
  56. ,u_softbed_mx.allow_edit
  57. ,u_softbed_mx.cutting_length
  58. ,u_softbed_mx.cutting_width
  59. ,u_softbed_mx.cutting_qty
  60. ,u_softbed_mx.useqty
  61. ,u_softbed_mx.use_formula
  62. ,u_softbed_mx.use_formula_str
  63. ,u_softbed_mx.actual_useqty
  64. ,u_softbed_mx.loss_rate
  65. ,u_softbed_mx.price
  66. ,u_softbed_mx.price_formula
  67. ,u_softbed_mx.price_formula_str
  68. ,u_softbed_mx.cost_price
  69. ,u_softbed_mx.cost_amt
  70. ,u_configure_code.name AS pzname
  71. ,u_configure_codemx.namemx AS pzmxname
  72. FROM u_softbed_mx
  73. INNER JOIN u_configure_codemx ON u_configure_codemx.pzid = u_softbed_mx.pzid
  74. AND u_configure_codemx.printid = u_softbed_mx.pz_printid
  75. INNER JOIN u_configure_code ON u_configure_code.pzid = u_configure_codemx.pzid";
  76. DbSqlHelper.SelectJoin(cmd, selectStr, "softbed_id = @billid", new Dictionary<string, object>() { { "@billid", billid } }, "printid,pz_printid", fields, 0, 0, mxlist);
  77. codeList = mxlist.GroupBy(item => new { item.pzid, item.pz_pringid })
  78. .Select(group => new u_configure_codemx
  79. {
  80. pzid = group.Key.pzid,
  81. printid = group.Key.pz_pringid,
  82. pzname = group.First().pzname,
  83. namemx = group.First().pzmxname,
  84. })
  85. .ToList();
  86. }
  87. /// <summary>
  88. /// 获取软床报价单据明细
  89. /// </summary>
  90. /// <param name="billid"></param>
  91. /// <param name="fields"></param>
  92. /// <param name="mxlist"></param>
  93. public List<u_softbed_mx> GetSoftBedMxList(int billid, string fields = null)
  94. {
  95. GetSoftBedMxList(billid, fields, out var mxlist, out _);
  96. return mxlist;
  97. }
  98. /// <summary>
  99. /// 根据部件配置项值获取对应BOM明细
  100. /// </summary>
  101. /// <param name="mxlist"></param>
  102. /// <param name="codeList"></param>
  103. public List<u_softbed_mx> GetSoftBedMxBomList(List<u_configure_codemx> codeList)
  104. {
  105. var mxlist = new List<u_softbed_mx>();
  106. foreach(var code in codeList)
  107. {
  108. var resultList = new List<u_configure_codemxbom>();
  109. var outputFields = @"pzid,printid,pid,mtrlid,sonscale,sonscale_formula,mng_cost_rate,profit_rate,realqty,cost,cost_emp,cost_date,sonloss,sonloss_formula,
  110. sondecloss,sondecloss_formula,deptid_scll,default_length,default_width,default_qty,mtrlcode,mtrlname,mtrlmode,unit,
  111. mtrlsectype,zxmtrlmode,usermtrlmode";
  112. var selectStr = @"SELECT u_configure_codemxbom.pzid
  113. ,u_configure_codemxbom.printid
  114. ,u_configure_codemxbom.pid
  115. ,u_configure_codemxbom.mtrlid
  116. ,u_configure_codemxbom.sonscale
  117. ,u_configure_codemxbom.sonscale_formula
  118. ,u_configure_codemxbom.mng_cost_rate
  119. ,u_configure_codemxbom.profit_rate
  120. ,u_configure_codemxbom.realqty
  121. ,u_configure_codemxbom.cost
  122. ,u_configure_codemxbom.cost_emp
  123. ,u_configure_codemxbom.cost_date
  124. ,u_configure_codemxbom.sonloss
  125. ,u_configure_codemxbom.sonloss_formula
  126. ,u_configure_codemxbom.sondecloss
  127. ,u_configure_codemxbom.sondecloss_formula
  128. ,u_configure_codemxbom.deptid_scll
  129. ,u_configure_codemxbom.default_length
  130. ,u_configure_codemxbom.default_width
  131. ,u_configure_codemxbom.default_qty
  132. ,u_mtrldef.mtrlcode
  133. ,u_mtrldef.mtrlname
  134. ,u_mtrldef.mtrlmode
  135. ,u_mtrldef.unit
  136. ,u_mtrldef.mtrlsectype
  137. ,u_mtrldef.zxmtrlmode
  138. ,u_mtrldef.usermtrlmode
  139. FROM u_configure_codemxbom
  140. INNER JOIN u_mtrldef ON u_configure_codemxbom.mtrlid = u_mtrldef.mtrlid";
  141. DbSqlHelper.SelectJoin(cmd,selectStr,
  142. "u_configure_codemxbom.pzid = @pzid AND u_configure_codemxbom.printid = @printid",
  143. new Dictionary<string, object>() { { "@pzid", code.pzid }, { "@printid",code.printid} },
  144. "u_configure_codemxbom.pid", outputFields, 0,0,resultList);
  145. foreach(var item in resultList)
  146. {
  147. mxlist.Add(InitSoftBedMxFromBom(item));
  148. }
  149. }
  150. return mxlist;
  151. }
  152. /// <summary>
  153. /// 初始化配置项值带出的BOM清单列表
  154. /// </summary>
  155. /// <param name="bomItem"></param>
  156. /// <returns></returns>
  157. public u_softbed_mx InitSoftBedMxFromBom(u_configure_codemxbom bomItem)
  158. {
  159. var mx = new u_softbed_mx()
  160. {
  161. pzid = bomItem.pzid,
  162. pz_pringid = bomItem.printid,
  163. mtrlid = bomItem.mtrlid,
  164. mtrlname = bomItem.mtrlname,
  165. mtrlcode = bomItem.mtrlcode,
  166. mtrlmode = bomItem.mtrlmode,
  167. unit = bomItem.unit,
  168. allow_edit = 0,
  169. has_type = bomItem.has_type, // 1-床头、2-床头柜、4-床架
  170. cutting_length = bomItem.default_length,
  171. cutting_width = bomItem.default_width,
  172. cutting_qty = bomItem.default_qty,
  173. useqty = bomItem.sonscale,
  174. use_formula = "",
  175. use_formula_str = bomItem.sonscale_formula,
  176. actual_useqty = 0,
  177. loss_rate = bomItem.sonloss,
  178. cost_price = bomItem.cost,
  179. cost_amt = 0
  180. };
  181. // 用量
  182. // 实际用量: 用量 * 损耗
  183. mx.actual_useqty = mx.useqty * mx.loss_rate;
  184. // 成本金额: 实际用量 * 成本单价
  185. mx.cost_amt = mx.actual_useqty * mx.cost_price;
  186. return mx;
  187. }
  188. /// <summary>
  189. /// 新建/修改 软床报价
  190. /// </summary>
  191. /// <param name="softbed"></param>
  192. /// <exception cref="LJCommonException"></exception>
  193. public void SaveSoftBed(u_softbed softbed)
  194. {
  195. if (softbed == null) throw new LJCommonException("软床报价保存失败,数据异常!");
  196. if (softbed.is_template == 0 && (softbed.mxList == null || softbed.mxList.Count <= 0)) throw new LJCommonException("软床报价保存失败,明细内容为空!");
  197. // 初始化属性
  198. AutoInit.AutoInitS(softbed);
  199. foreach(var mx in softbed.mxList)
  200. {
  201. AutoInit.AutoInitS(mx);
  202. }
  203. // TODO:计算价格
  204. CalCulateFormula(softbed);
  205. //
  206. var dtNow = context.opdate;
  207. var fields = @"softbed_relcode,softbed_name,deptid,mtrlmode,mtrltype,has_headboard,has_nightstand,has_bedframe,is_template,
  208. template_id,template_code,template_name,commission,taxes,taxrate,other_rate,extras_cost,money_type,moneyrate,dscrp,costamt,nottax_factory_cost,nottax_dept_cost,
  209. dept_cost,foreign_cost";
  210. var mx_fields = @"softbed_id,printid,pzid,pz_printid,mtrlid,mtrlname,mtrlcode,mtrlmode,unit,has_type,allow_edit,cutting_length,cutting_width,cutting_qty,
  211. useqty,use_formula,use_formula_str,actual_useqty,loss_rate,price,price_formula,price_formula_str,cost_price,cost_amt,pzname,pzmxname";
  212. if(softbed.softbed_id == 0)
  213. {
  214. // 新建
  215. fields += ",softbed_id,softbed_code,create_date,create_emp";
  216. softbed.softbed_id = BllHelper.GetID(cmd, "u_softbed");
  217. softbed.create_date = dtNow;
  218. softbed.create_emp = context.tokendata.username;
  219. if (string.IsNullOrEmpty(softbed.softbed_code))
  220. {
  221. // 编号-年月日+流水
  222. softbed.softbed_code = $"RC-{dtNow.ToString("yyyyMMdd")}{(softbed.softbed_id % 10000).ToString("D4")}";
  223. }
  224. DbSqlHelper.Insert(cmd, "u_softbed", null, softbed, fields);
  225. } else
  226. {
  227. // 修改
  228. softbed.update_date = dtNow;
  229. softbed.update_emp = context.tokendata.username;
  230. fields += ",update_date,update_emp";
  231. cmd.CommandText = @"DELETE FROM u_softbed_mx WHERE softbed_id = @softbed_id";
  232. cmd.Parameters.Clear();
  233. cmd.Parameters.AddWithValue("@softbed_id", softbed.softbed_id);
  234. cmd.ExecuteNonQuery();
  235. DbSqlHelper.Update(cmd, "u_softbed", null, softbed, "softbed_id", fields);
  236. }
  237. for (int i = 0; i < softbed.mxList.Count; i++)
  238. {
  239. var mx = softbed.mxList[i];
  240. mx.softbed_id = softbed.softbed_id;
  241. mx.printid = i + 1;
  242. DbSqlHelper.Insert(cmd, "u_softbed_mx", null, mx, mx_fields);
  243. }
  244. SaveSoftBedTemplate(softbed);
  245. }
  246. /// <summary>
  247. /// 新建软床报价模板
  248. /// </summary>
  249. /// <param name="softbed"></param>
  250. private void SaveSoftBedTemplate(u_softbed softbed)
  251. {
  252. if (softbed.is_template == 0) return;
  253. if(string.IsNullOrEmpty(softbed.softbed_code))
  254. {
  255. throw new LJCommonException("报价未生成唯一码,无法生成模板配置");
  256. }
  257. string prefix = $"{softbed.softbed_code}|";
  258. var configureList = new List<u_configure_type>();
  259. if(softbed.has_headboard == 1)
  260. {
  261. configureList.Add(new u_configure_type()
  262. {
  263. contfigtypeid = 0,
  264. contfigtypename = $"{prefix}床头",
  265. contfigtype = 0,
  266. usechflag = 1,
  267. flag = 0
  268. });
  269. }
  270. if(softbed.has_bedframe == 1)
  271. {
  272. configureList.Add(new u_configure_type()
  273. {
  274. contfigtypeid = 0,
  275. contfigtypename = $"{prefix}床架",
  276. contfigtype = 0,
  277. usechflag = 1,
  278. flag = 0
  279. });
  280. }
  281. if (softbed.has_nightstand == 1)
  282. {
  283. configureList.Add(new u_configure_type()
  284. {
  285. contfigtypeid = 0,
  286. contfigtypename = $"{prefix}床头柜",
  287. contfigtype = 0,
  288. usechflag = 1,
  289. flag = 0
  290. });
  291. }
  292. var baseInfoHelper = GetHelper<BasicInfoHelper>(cmd, context);
  293. foreach(var configure in configureList)
  294. {
  295. // 判断是否已存在
  296. cmd.CommandText = @"SELECT COUNT(*) FROM u_configure_type WHERE LTRIM(RTRIM(contfigtypename)) = @contfigtypename";
  297. cmd.Parameters.Clear();
  298. cmd.Parameters.AddWithValue("@contfigtypename", configure.contfigtypename);
  299. var cnt = Convert.ToInt32(cmd.ExecuteScalar());
  300. if (cnt > 0) continue;
  301. baseInfoHelper.SaveConfigureType(configure);
  302. }
  303. }
  304. public List<u_configure_code> GetSoftBedConfigureCodeList(u_softbed softbed)
  305. {
  306. var codeList = new List<u_configure_code>();
  307. var selectStr = @"SELECT LTRIM(RTRIM(u_configure_type.configurename)) AS configurename
  308. ,u_configure_code.typeid
  309. ,u_configure_code.pzid
  310. ,u_configure_code.name
  311. ,u_configure_code.pzcode
  312. ,u_configure_code.inputtype
  313. FROM u_configure_code
  314. INNER JOIN u_configure_type ON u_configure_code.typeid = u_configure_type.configureid
  315. WHERE LTRIM(RTRIM(u_configure_type.configurename)) IN ()";
  316. var whereList = new List<string>();
  317. var nameList = new List<string>();
  318. if (softbed.softbed_id > 0)
  319. {
  320. // 模版配置获取
  321. var _softbed = GetSoftBed(softbed.softbed_id, "softbed_id,softbed_code,has_headboard,has_nightstand,has_bedframe");
  322. string prefix = $"{_softbed.softbed_code}|";
  323. if(_softbed.has_headboard == 1)
  324. {
  325. nameList.Add($"{prefix}床头");
  326. }
  327. if (_softbed.has_nightstand == 1)
  328. {
  329. nameList.Add($"{prefix}床头柜");
  330. }
  331. if (_softbed.has_bedframe == 1)
  332. {
  333. nameList.Add($"{prefix}床架");
  334. }
  335. }
  336. if(nameList.Count > 0)
  337. {
  338. whereList.Add($"LTRIM(RTRIM(u_configure_type.configurename)) IN {ListEx.getString(nameList)}");
  339. }
  340. }
  341. /// <summary>
  342. /// 复制软床报价
  343. /// </summary>
  344. /// <param name="softbed"></param>
  345. /// <param name="newId"></param>
  346. public void CopySoftBed(u_softbed softbed, out int newId)
  347. {
  348. var fields = @"mtrlmode,mtrltype,has_headboard,has_nightstand,has_bedframe,is_template,
  349. template_id,template_code,template_name,commission,taxes,taxrate,other_rate,extras_cost,moneyrate";
  350. var softbed_copy = GetSoftBed(softbed.softbed_id, fields);
  351. // 判断copy_bedNet.bednetcode是否存在@@字符串,如果存在,则删除@@后面的字符串,包括@@
  352. if (softbed_copy.softbed_code.IndexOf("@@") > -1)
  353. {
  354. softbed_copy.softbed_code = softbed_copy.softbed_code.Substring(softbed_copy.softbed_code.IndexOf("@@"));
  355. }
  356. softbed_copy.softbed_code += " @@";
  357. softbed_copy.softbed_code += DateTime.Now.ToString("yyyMMdd_mmhhss");
  358. softbed_copy.softbed_id = 0;
  359. SaveSoftBed(softbed_copy);
  360. newId = softbed_copy.softbed_id;
  361. }
  362. /// <summary>
  363. /// 删除软床报价
  364. /// </summary>
  365. /// <param name="billid"></param>
  366. /// <exception cref="LJCommonException"></exception>
  367. public void DeleteSoftBed(int billid)
  368. {
  369. var softbed = GetSoftBed(billid, "softbed_code,flag");
  370. if (softbed == null) throw new LJCommonException($"单据不存在,请检查! billid:{billid}");
  371. if (softbed.flag == 1) throw new LJCommonException($"单据:{softbed.softbed_code}已审核,无法删除!");
  372. DbSqlHelper.Delete(cmd, softbed);
  373. }
  374. /// <summary>
  375. /// 审核软床报价
  376. /// </summary>
  377. /// <param name="billid"></param>
  378. /// <exception cref="LJCommonException"></exception>
  379. public void AuditSoftBed(int billid)
  380. {
  381. var softbed = GetSoftBed(billid, "softbed_code,flag");
  382. if (softbed == null) throw new LJCommonException($"单据不存在,请检查! billid:{billid}");
  383. if (softbed.flag == 1) throw new LJCommonException($"单据:{softbed.softbed_code}未撤审,无法审核!");
  384. softbed.flag = 1;
  385. softbed.audit_date = context.opdate;
  386. softbed.audit_emp = context.tokendata.username;
  387. DbSqlHelper.Update(cmd, "u_softbed",null,softbed, "softbed_id", "flag,audit_date,audit_emp");
  388. }
  389. /// <summary>
  390. /// 撤审软床报价
  391. /// </summary>
  392. /// <param name="billid"></param>
  393. /// <exception cref="LJCommonException"></exception>
  394. public void CAuditSoftBed(int billid)
  395. {
  396. var softbed = GetSoftBed(billid, "softbed_code,flag");
  397. if (softbed == null) throw new LJCommonException($"单据不存在,请检查! billid:{billid}");
  398. if (softbed.flag == 0) throw new LJCommonException($"单据:{softbed.softbed_code}未审核,无法撤审!");
  399. softbed.flag = 0;
  400. softbed.audit_date = null;
  401. softbed.audit_emp = string.Empty;
  402. DbSqlHelper.Update(cmd, "u_softbed", null, softbed, "softbed_id", "flag,audit_date,audit_emp");
  403. }
  404. public void CalCulateFormula(u_softbed softbed)
  405. {
  406. InitSoftBed(softbed);
  407. InitReplaceMents(softbed);
  408. foreach (var mx in softbed.mxList)
  409. {
  410. InitMxReplaceMents(softbed, mx);
  411. }
  412. }
  413. private void InitSoftBed(u_softbed softbed)
  414. {
  415. var dept = Cache.GetData<int, u_dept, DeptMapping>(softbed.deptid);
  416. softbed.moneyrate = softbed.moneyrate <= 0 ? 1 : softbed.moneyrate;
  417. softbed.commission = softbed.commission <= 0 ? 1 : softbed.commission;
  418. softbed.taxrate = softbed.taxrate <= 0 ? 1 : softbed.taxrate;
  419. softbed.other_rate = softbed.other_rate <= 0 ? 1 : softbed.other_rate;
  420. softbed.dept_profitrate = softbed.dept_profitrate <= 0 ? 1 : softbed.dept_profitrate;
  421. // 检查佣金是否小于1
  422. if (softbed.commission < 1)
  423. {
  424. throw new LJCommonException("佣金点数不能小于1!");
  425. }
  426. // 检查税率是否小于1
  427. if (softbed.taxrate < 1)
  428. {
  429. throw new LJCommonException("税率不能小于1!");
  430. }
  431. // 检查额外点数是否小于1
  432. if (softbed.other_rate < 1)
  433. {
  434. throw new LJCommonException("税率不能小于1!");
  435. }
  436. // 检查部门利润率是否为0
  437. if (softbed.dept_profitrate == 0)
  438. {
  439. throw new LJCommonException("部门利润率不能为0!");
  440. }
  441. if(softbed.is_template == 1)
  442. {
  443. // 使用模板报价
  444. softbed.template_id = 0;
  445. softbed.template_code = string.Empty;
  446. softbed.template_name = string.Empty;
  447. }
  448. }
  449. private void InitReplaceMents(u_softbed softbed)
  450. {
  451. //AddKeyValue("不含税出厂价", "【车间成本】*(【工厂利润率】+【外销加点】)",0);
  452. //AddKeyValue("部门不含税价", "【不含税出厂价】/【部门利润率】/( 1 - (【佣金点数】- 1))*【额外点数】", 0);
  453. //AddKeyValue("税金", "【部门不含税价】* (【税率】-1)", 0);
  454. //AddKeyValue("部门含税价", "【部门不含税价】*【税率】", 0);
  455. //AddKeyValue("外币价", "【部门含税价】/【汇率】", 0);
  456. //// 初始变量
  457. //AddKeyValue("部门利润率", string.Empty,softbed.dept_profitrate);
  458. //AddKeyValue("佣金点数", string.Empty, softbed.commission);
  459. //AddKeyValue("额外点数", string.Empty, softbed.other_rate);
  460. //AddKeyValue("额外费用", string.Empty, softbed.extras_cost);
  461. ////AddKeyValue("FOB", softbed.fob);
  462. //AddKeyValue("汇率", string.Empty, softbed.moneyrate);
  463. //AddKeyValue("税率", string.Empty, softbed.taxrate);
  464. }
  465. private void InitMxReplaceMents(u_softbed softbed,u_softbed_mx mx)
  466. {
  467. //AddKeyValue("下料长", string.Empty,mx.cutting_length);
  468. //AddKeyValue("下料宽", string.Empty, mx.cutting_width);
  469. //AddKeyValue("下料数量", string.Empty, mx.cutting_qty);
  470. //AddKeyValue("用料量", string.Empty, mx.useqty);
  471. //AddKeyValue("损耗率", string.Empty, mx.loss_rate);
  472. //AddKeyValue("材料单价", string.Empty, mx.price);
  473. //AddKeyValue("成本单价", string.Empty, mx.cost_price);
  474. }
  475. #region 通用公式
  476. private CalculateFormula formula = new CalculateFormula();
  477. #endregion
  478. }
  479. }