var 产品明细 =
[{ "itmKey": 96528, "prdName": "设计柜体", "wth": 800, "hgt": 2100, "thk": 600, "qty_q": 1, "prdId": 35311, "matName": "18颗粒板北欧森林", "param1": "柜体", "prdSpc": "", "param2": "", "param3": "", "param4": "", "subDtls": [{ "parKey": 96528, "sPrdName": "胶粒左侧板", "wth": 575, "hgt": 2100, "thk": 18, "qty": 1, "matName": "18颗粒板北欧森林", "ut": "平方", "barCode": "102176946", "param1": null, "sPrdSpc": "左侧板", "param2": null }, { "parKey": 96528, "sPrdName": "胶粒右侧板", "wth": 575, "hgt": 2100, "thk": 18, "qty": 1, "matName": "18颗粒板北欧森林", "ut": "平方", "barCode": "102176947", "param1": null, "sPrdSpc": "右侧板", "param2": null }, { "parKey": 96528, "sPrdName": "A三合一顶板孔朝上NS1", "wth": 574, "hgt": 763, "thk": 18, "qty": 1, "matName": "18颗粒板北欧森林", "ut": "平方", "barCode": "102176948", "param1": null, "sPrdSpc": "顶板", "param2": null }, { "parKey": 96528, "sPrdName": "A三合一底板孔朝下NS1", "wth": 574, "hgt": 763, "thk": 18, "qty": 1, "matName": "18颗粒板北欧森林", "ut": "平方", "barCode": "102176949", "param1": null, "sPrdSpc": "底板", "param2": null }, { "parKey": 96528, "sPrdName": "9mm薄背板竖纹A", "wth": 774, "hgt": 2074, "thk": 9, "qty": 1, "matName": "9颗粒板北欧森林", "ut": "平方", "barCode": "102176950", "param1": null, "sPrdSpc": "9mm背板", "param2": null }, { "parKey": 96528, "sPrdName": "A三合一层板孔朝下NS1", "wth": 545, "hgt": 763, "thk": 18, "qty": 1, "matName": "18颗粒板北欧森林", "ut": "平方", "barCode": "102176951", "param1": null, "sPrdSpc": "三合一层板", "param2": null }] }, { "itmKey": 96529, "prdName": "设计柜体", "wth": 800, "hgt": 2100, "thk": 600, "qty_q": 1, "prdId": 35311, "matName": "18颗粒板北欧森林", "param1": "柜体", "prdSpc": "", "param2": "", "param3": "", "param4": "", "subDtls": [{ "parKey": 96529, "sPrdName": "胶粒左侧板", "wth": 575, "hgt": 2100, "thk": 18, "qty": 1, "matName": "18颗粒板北欧森林", "ut": "平方", "barCode": "102176957", "param1": null, "sPrdSpc": "左侧板", "param2": null }, { "parKey": 96529, "sPrdName": "胶粒右侧板", "wth": 575, "hgt": 2100, "thk": 18, "qty": 1, "matName": "18颗粒板北欧森林", "ut": "平方", "barCode": "102176958", "param1": null, "sPrdSpc": "右侧板", "param2": null }, { "parKey": 96529, "sPrdName": "A三合一顶板孔朝上NS1", "wth": 574, "hgt": 763, "thk": 18, "qty": 1, "matName": "18颗粒板北欧森林", "ut": "平方", "barCode": "102176959", "param1": null, "sPrdSpc": "顶板", "param2": null }, { "parKey": 96529, "sPrdName": "A三合一底板孔朝下NS1", "wth": 574, "hgt": 763, "thk": 18, "qty": 1, "matName": "18颗粒板北欧森林", "ut": "平方", "barCode": "102176960", "param1": null, "sPrdSpc": "底板", "param2": null }, { "parKey": 96529, "sPrdName": "9mm薄背板竖纹A", "wth": 774, "hgt": 2074, "thk": 9, "qty": 1, "matName": "9颗粒板北欧森林", "ut": "平方", "barCode": "102176961", "param1": null, "sPrdSpc": "9mm背板", "param2": null }, { "parKey": 96529, "sPrdName": "A三合一层板孔朝下NS1", "wth": 545, "hgt": 763, "thk": 18, "qty": 1, "matName": "18颗粒板北欧森林", "ut": "平方", "barCode": "102176962", "param1": null, "sPrdSpc": "三合一层板", "param2": null }] }, { "itmKey": 0, "prdName": "三合一扣件12厘", "wth": 0, "hgt": 0, "thk": 0, "qty_q": 12, "prdId": 35311, "matName": "", "param1": "五金", "prdSpc": "", "param2": "WJ01.BA01.070", "param3": "", "param4": "", "subDtls": [] }, { "itmKey": 0, "prdName": "木榫", "wth": 0, "hgt": 0, "thk": 0, "qty_q": 24, "prdId": 35311, "matName": "", "param1": "五金", "prdSpc": "", "param2": "WJ01.BA01.008", "param3": "", "param4": "", "subDtls": [] }, { "itmKey": 0, "prdName": "DTC全盖铰链", "wth": 0, "hgt": 0, "thk": 0, "qty_q": 6, "prdId": 35311, "matName": "", "param1": "五金", "prdSpc": "", "param2": "WJ01.BA04.001", "param3": "", "param4": "", "subDtls": [] }, { "itmKey": 0, "prdName": "4*30自攻螺丝", "wth": 0, "hgt": 0, "thk": 0, "qty_q": 8, "prdId": 35311, "matName": "", "param1": "五金", "prdSpc": "", "param2": "WJ01.BA01.062", "param3": "", "param4": "", "subDtls": [] }, { "itmKey": 0, "prdName": "防水脚钉", "wth": 0, "hgt": 0, "thk": 0, "qty_q": 12, "prdId": 35311, "matName": "", "param1": "五金", "prdSpc": "", "param2": "WJ01.BA01.009", "param3": "", "param4": "", "subDtls": [] }, { "itmKey": 0, "prdName": "三合一扣件12厘", "wth": 0, "hgt": 0, "thk": 0, "qty_q": 24, "prdId": 35311, "matName": "", "param1": "五金", "prdSpc": "", "param2": "WJ01.BA01.070", "param3": "", "param4": "", "subDtls": [] }, { "itmKey": 0, "prdName": "三合一扣件12厘", "wth": 0, "hgt": 0, "thk": 0, "qty_q": 36, "prdId": 35311, "matName": "", "param1": "五金", "prdSpc": "", "param2": "WJ01.BA01.070", "param3": "", "param4": "", "subDtls": [] }, { "itmKey": 0, "prdName": "平口全盖铰链", "wth": 0, "hgt": 0, "thk": 0, "qty_q": 4, "prdId": 35311, "matName": "", "param1": "五金", "prdSpc": "", "param2": "WJ01.CA02.068", "param3": "", "param4": "", "subDtls": [] }, { "itmKey": 0, "prdName": "内六角螺丝-土豪金", "wth": 0, "hgt": 0, "thk": 0, "qty_q": 16, "prdId": 35311, "matName": "", "param1": "五金", "prdSpc": "", "param2": "WJ01.CA02.082", "param3": "", "param4": "", "subDtls": [] }, { "itmKey": 0, "prdName": "20铁角码", "wth": 0, "hgt": 0, "thk": 0, "qty_q": 8, "prdId": 35311, "matName": "", "param1": "五金", "prdSpc": "", "param2": "WJ01.CA02.080", "param3": "", "param4": "", "subDtls": [] }, { "itmKey": 0, "prdName": "三合一12厘合金黑帽盖", "wth": 0, "hgt": 0, "thk": 0, "qty_q": 36, "prdId": 35311, "matName": "", "param1": "五金", "prdSpc": "", "param2": "WJ01.BA01.084", "param3": "", "param4": "", "subDtls": [] }, { "itmKey": 594550, "prdName": "T01门板", "wth": 800, "hgt": 1260, "thk": 25, "qty_q": 1, "prdId": 35311, "matName": "", "param1": "门板", "prdSpc": "左开门板", "param2": "120406", "param3": "102176946", "param4": "{\"M孔F\":0,\"M孔E\":0,\"M孔D\":0,\"M孔C\":530,\"M孔B\":100,\"M孔A\":100,\"M拉直器\":0,\"M加价\":0,\"M面积\":1.008,\"M厚\":18,\"M宽\":800,\"M高\":1260,\"M颜色\":\"18颗粒板北欧森林\",\"M材质\":\"颗粒板\",\"M名称\":\"左开门板\",\"M开门\":\"左开\",\"M门型\":\"T01\"}", "subDtls": [{ "parKey": 594550, "sPrdName": "通用门", "wth": 800, "hgt": 1260, "thk": 18, "qty": 1, "matName": "18颗粒板北欧森林", "ut": "平方", "barCode": "102176954", "param1": "门板", "sPrdSpc": "左开门板", "param2": "120406" }] }, { "itmKey": 594552, "prdName": "T01门板", "wth": 800, "hgt": 1260, "thk": 25, "qty_q": 1, "prdId": 35311, "matName": "", "param1": "门板", "prdSpc": "左开门板", "param2": "120406", "param3": "102176956", "param4": "{\"M孔F\":0,\"M孔E\":0,\"M孔D\":0,\"M孔C\":530,\"M孔B\":100,\"M孔A\":100,\"M拉直器\":0,\"M加价\":0,\"M面积\":1.008,\"M厚\":18,\"M宽\":800,\"M高\":1260,\"M颜色\":\"18颗粒板北欧森林\",\"M材质\":\"颗粒板\",\"M名称\":\"左开门板\",\"M开门\":\"左开\",\"M门型\":\"T01\"}", "subDtls": [{ "parKey": 594552, "sPrdName": "通用门", "wth": 800, "hgt": 1260, "thk": 18, "qty": 1, "matName": "18颗粒板北欧森林", "ut": "平方", "barCode": "102176963", "param1": "门板", "sPrdSpc": "左开门板", "param2": "120406" }] }, { "itmKey": 594549, "prdName": "L04铝框玻璃门1", "wth": 800, "hgt": 840, "thk": 25, "qty_q": 1, "prdId": 35311, "matName": "", "param1": "门板", "prdSpc": "L04A拉丝铜金左开门-拉手靠上", "param2": "120480", "param3": "102176946", "param4": "{\"M孔F\":0,\"M孔E\":0,\"M孔D\":0,\"M孔C\":0,\"M孔B\":100,\"M孔A\":100,\"M拉直器\":0,\"M加价\":0,\"M面积\":0.672,\"M厚\":21.5,\"M宽\":800,\"M高\":840,\"M颜色\":\"拉丝铜金\",\"M材质\":\"铝门产品\",\"M名称\":\"L04A拉丝铜金左开门-拉手靠上\",\"M开门\":\"左开门\",\"M门型\":\"L04A-拉手靠上\",\"左边框\":\"L04边框-拉丝铜金\",\"上边框\":\"L04边框-拉丝铜金\",\"右边框\":\"L04A-L2短拉手边框-拉丝铜金\",\"下边框\":\"L04边框-拉丝铜金\",\"芯板\":\"5mm欧灰钢化玻璃\"}", "subDtls": [{ "parKey": 594549, "sPrdName": "玻璃", "wth": 795, "hgt": 835, "thk": 5, "qty": 1, "matName": "5mm欧灰钢化玻璃", "ut": "平方", "barCode": "102176952", "param1": "门板", "sPrdSpc": "5mm欧灰钢化玻璃", "param2": "120480" }, { "parKey": 594549, "sPrdName": "铝框门板", "wth": 800, "hgt": 840, "thk": 21.5, "qty": 1, "matName": "铝门产品", "ut": "平方", "barCode": "102176953", "param1": "门板", "sPrdSpc": "L04A拉丝铜金左开门-拉手靠上", "param2": "120480" }, { "parKey": 594549, "sPrdName": "L04边框-拉丝铜金", "wth": 20, "hgt": 800, "thk": 21.5, "qty": 1, "matName": "", "ut": "平方", "barCode": "", "param1": "", "sPrdSpc": "", "param2": "" }, { "parKey": 594549, "sPrdName": "L04边框-拉丝铜金", "wth": 20, "hgt": 800, "thk": 21.5, "qty": 1, "matName": "", "ut": "平方", "barCode": "", "param1": "", "sPrdSpc": "", "param2": "" }, { "parKey": 594549, "sPrdName": "L04边框-拉丝铜金", "wth": 20, "hgt": 840, "thk": 21.5, "qty": 1, "matName": "", "ut": "平方", "barCode": "", "param1": "", "sPrdSpc": "", "param2": "" }, { "parKey": 594549, "sPrdName": "L04A-L2短拉手边框-拉丝铜金", "wth": 20, "hgt": 840, "thk": 21.5, "qty": 1, "matName": "", "ut": "平方", "barCode": "", "param1": "", "sPrdSpc": "", "param2": "" }] }, { "itmKey": 594551, "prdName": "L04铝框玻璃门1", "wth": 800, "hgt": 840, "thk": 25, "qty_q": 1, "prdId": 35311, "matName": "", "param1": "门板", "prdSpc": "L04A拉丝铜金右开门-拉手靠上", "param2": "120480", "param3": "102176956", "param4": "{\"M孔F\":0,\"M孔E\":0,\"M孔D\":0,\"M孔C\":0,\"M孔B\":100,\"M孔A\":100,\"M拉直器\":0,\"M加价\":0,\"M面积\":0.672,\"M厚\":21.5,\"M宽\":800,\"M高\":840,\"M颜色\":\"拉丝铜金\",\"M材质\":\"铝门产品\",\"M名称\":\"L04A拉丝铜金右开门-拉手靠上\",\"M开门\":\"右开门\",\"M门型\":\"L04A-拉手靠上\",\"左边框\":\"L04A-L2短拉手边框-拉丝铜金\",\"上边框\":\"L04边框-拉丝铜金\",\"右边框\":\"L04边框-拉丝铜金\",\"下边框\":\"L04边框-拉丝铜金\",\"芯板\":\"5mm欧灰钢化玻璃\"}", "subDtls": [{ "parKey": 594551, "sPrdName": "玻璃", "wth": 795, "hgt": 835, "thk": 5, "qty": 1, "matName": "5mm欧灰钢化玻璃", "ut": "平方", "barCode": "102176955", "param1": "门板", "sPrdSpc": "5mm欧灰钢化玻璃", "param2": "120480" }, { "parKey": 594551, "sPrdName": "铝框门板", "wth": 800, "hgt": 840, "thk": 21.5, "qty": 1, "matName": "铝门产品", "ut": "平方", "barCode": "102176956", "param1": "门板", "sPrdSpc": "L04A拉丝铜金右开门-拉手靠上", "param2": "120480" }, { "parKey": 594551, "sPrdName": "L04边框-拉丝铜金", "wth": 20, "hgt": 800, "thk": 21.5, "qty": 1, "matName": "", "ut": "平方", "barCode": "", "param1": "", "sPrdSpc": "", "param2": "" }, { "parKey": 594551, "sPrdName": "L04边框-拉丝铜金", "wth": 20, "hgt": 800, "thk": 21.5, "qty": 1, "matName": "", "ut": "平方", "barCode": "", "param1": "", "sPrdSpc": "", "param2": "" }, { "parKey": 594551, "sPrdName": "L04A-L2短拉手边框-拉丝铜金", "wth": 20, "hgt": 840, "thk": 21.5, "qty": 1, "matName": "", "ut": "平方", "barCode": "", "param1": "", "sPrdSpc": "", "param2": "" }, { "parKey": 594551, "sPrdName": "L04边框-拉丝铜金", "wth": 20, "hgt": 840, "thk": 21.5, "qty": 1, "matName": "", "ut": "平方", "barCode": "", "param1": "", "sPrdSpc": "", "param2": "" }] }]
var 订单明细 = [];
function 门参数(产品) {
//门板参数提取
var 参数 = JSON.parse(产品.param4);
var 对方货号 = JSON.parse(产品.param2);
var 芯板名称 = 参数.M芯板 == null || 参数.M芯板 == undefined || 参数.M芯板 == "" ? "" : 参数.M芯板;
var M加价 = 参数.M加价 == null || 参数.M加价 == undefined || 参数.M加价 == "" ? "" : 参数.M加价;
var M拉直器 = 参数.M拉直器 == null || 参数.M拉直器 == undefined || 参数.M拉直器 == "" ? "" : 参数.M拉直器;
var Akw = 参数.M孔A == null || 参数.M孔A == undefined || 参数.M孔A == "" ? "" : 参数.M孔A;
var Bkw = 参数.M孔B == null || 参数.M孔B == undefined || 参数.M孔B == "" ? "" : 参数.M孔B;
var Ckw = 参数.M孔C == null || 参数.M孔C == undefined || 参数.M孔C == "" ? "" : 参数.M孔C;
var Dkw = 参数.M孔D == null || 参数.M孔D == undefined || 参数.M孔D == "" ? "" : 参数.M孔D;
var Ekw = 参数.M孔E == null || 参数.M孔E == undefined || 参数.M孔E == "" ? "" : 参数.M孔E;
var Fkw = 参数.M孔F == null || 参数.M孔F == undefined || 参数.M孔F == "" ? "" : 参数.M孔F;
var 铰孔 = Akw + "/" + Bkw + "/" + Ckw + "/" + Dkw + "/" + Ekw + "/" + Fkw;
var 下框 = 参数.M下边框 == null || 参数.M下边框 == undefined || 参数.M下边框 == "" ? "" : 参数.M下边框;
var 右框 = 参数.M右边框 == null || 参数.M右边框 == undefined || 参数.M右边框 == "" ? "" : 参数.M右边框;
var 上框 = 参数.M上边框 == null || 参数.M上边框 == undefined || 参数.M上边框 == "" ? "" : 参数.M上边框;
var 左框 = 参数.M左边框 == null || 参数.M左边框 == undefined || 参数.M左边框 == "" ? "" : 参数.M左边框;
var prdSpc = 参数.M门型 == null || 参数.M门型 == undefined || 参数.M门型 == "" ? "" : 参数.M门型;
var kw = 参数.M开门 == null || 参数.M开门 == undefined || 参数.M开门 == "" ? "" : 参数.M开门;
var prdName = 参数.M名称 == null || 参数.M名称 == undefined || 参数.M名称 == "" ? "" : 参数.M名称;
var matName = 参数.M材质 == null || 参数.M材质 == undefined || 参数.M材质 == "" ? "" : 参数.M材质;
var clr = 参数.M颜色 == null || 参数.M颜色 == undefined || 参数.M颜色 == "" ? "" : 参数.M颜色;
var hgt = 参数.M高 == null || 参数.M高 == undefined || 参数.M高 == "" ? "" : 参数.M高;
var wth = 参数.M宽 == null || 参数.M宽 == undefined || 参数.M宽 == "" ? "" : 参数.M宽;
var thk = 参数.M厚 == null || 参数.M厚 == undefined || 参数.M厚 == "" ? "" : 参数.M厚;
var qty_a = 参数.M面积 == null || 参数.M面积 == undefined || 参数.M面积 == "" ? "" : 参数.M面积;
var mbPames = [{
prdSpc:prdSpc,
matName:matName,
clr:clr,
wth:wth,
hgt:hgt,
thk:thk,
qty_a:qty_a,
kw:kw,
JLK:铰孔,
对方货号:对方货号,
芯板名称:芯板名称,
M加价:M加价,
M拉直器:M拉直器
}];
return mbPames;
}
function 转换产品为一个新的明细行门板对象(产品) {
//注意新对象的格式,需要按照"明细行对象"JSON格式
var 门板对象 = {
prdId: 2,////待转换查询产品库
useRoom: useRoom,
prdName: 产品.prdName,//名称
prdSpc: 门型,//造型
prdType: prdType,//产品的分类属性
matId: matId,////待转换查询产品库
matName: matName,////待转换查询产品库
clr: clr,//颜色
wl: wl,//纹理
wth: wth,//宽
hgt: hgt,//高
thk: thk,//厚
qty_q: qty_q,//块
qty_a: qty_a,//面积
prdUt: prdUt,
kw: kw,//孔位
upType: upType,//单价来源
up: up,//固定单价
rem: rem,//特殊说明
dtls: [] //此处定义用于存放子表数据,先预值为空数组,后面在用来写入
}
//材质处理
//产品Id处理
var prdId = "";
var 产品对象列表 = helper.getPrdListBySupSpc(对方货号);
//价格处理等
return 门板对象;
}
function 转换产品为一个新的明细行柜体对象(产品) {
//注意新对象的格式,需要按照"明细行对象"JSON格式
var 新对象 = {
prdId: 2,
prdName: 产品.prdName,
prdSpc: 产品.prdSpc,
dtls: [] //此处定义用于存放子表数据,先预值为空数组,后面在用来写入
}
//门板参数
var 参数 = JSON.parse(产品.param4);
新对象.kw = 参数.s;
//材质处理
//产品Id处理
//价格处理等
return 新对象;
}
function 转换产品为一个新的明细行五金对象(产品) {
//注意新对象的格式,需要按照"明细行对象"JSON格式
var 新对象 = {
prdId: 2,
prdName: 产品.prdName,
prdSpc: 产品.prdSpc,
dtls: [] //此处定义用于存放子表数据,先预值为空数组,后面在用来写入
}
//门板参数
var 参数 = JSON.parse(产品.param4);
新对象.kw = 参数.s;
//材质处理
//产品Id处理
//价格处理等
return 新对象;
}
///-------------------------------------------------------------------------
function 转换部件为一个新的子表行对象(部件) {
var 新子表行 = {
prdName: 部件.sPrdName, //注意此处上传的部件名称为sPrdName,
//导入到报价时,要求字段为prdName
prdSpc: 部件.sPrdSpc,
wth: 部件.wth,
hgt: 部件.hgt,
};
//材质处理
新子表行.matId = 4;
新子表行.matName = ""
//价格处理
return 新子表行;
}
//循环上传的产品明细
for (var i = 0; i < 产品明细.length; i++) {
var 产品 = 产品明细[i];
//不是门板的不进行处理
var 明细行对象 = null;
if (产品.param1 == "门板") {
明细行对象 = 转换产品为一个新的明细行门板对象(产品);
} else if (产品.param1 == "柜体") {
continue;
明细行对象 = 转换产品为一个新的明细行柜体对象(产品);
} else if (产品.param1 == "五金") {
continue;
明细行对象 = 转换产品为一个新的明细行五金对象(产品)
}
//将上传的产品对象进行转换为一个明细行对象,并插入到订单明细中
订单明细.push(明细行对象);
//循环上传产品的部件
for (var j = 0; j < 产品.subDtls.length; j++) {
var 部件 = 产品.subDtls[j];
var 子表行对象 = 转换部件为一个新的子表行对象(部件);
//注意此处将新的子表行对象一定要插入至明细行对象的dtls数组中,见代码行第8行
明细行对象.dtls.push(子表行对象);
}
}
console