Browse Source

[update]销售管理:销售订单信息添加物料销售报价添加计划交付时间,质保天数。

dev
zhangsiqi 5 months ago
parent
commit
d22d9cad69
  1. 22
      ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSalesOrderChild.java
  2. 25
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesOrderServiceImpl.java
  3. 32
      ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderChildMapper.xml
  4. 76
      ruoyi-admin/src/main/resources/templates/system/salesOrder/add.html
  5. 22
      ruoyi-admin/src/main/resources/templates/system/salesOrder/detail.html
  6. 198
      ruoyi-admin/src/main/resources/templates/system/salesOrder/edit.html

22
ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSalesOrderChild.java

@ -112,6 +112,10 @@ public class SysSalesOrderChild extends BaseEntity {
@Excel(name = "物料的不含税总价(RMB)") @Excel(name = "物料的不含税总价(RMB)")
private Double materialRmbSum; private Double materialRmbSum;
@Excel(name = "计划交付时间")
private String deliveryTime;
@Excel(name = "质保天数")
private String expiryDay;
/*业务人员*/ /*业务人员*/
@Excel(name = "业务人员") @Excel(name = "业务人员")
private String businessMembers; private String businessMembers;
@ -355,6 +359,22 @@ public class SysSalesOrderChild extends BaseEntity {
this.materialRmbSum = materialRmbSum; this.materialRmbSum = materialRmbSum;
} }
public String getDeliveryTime() {
return deliveryTime;
}
public void setDeliveryTime(String deliveryTime) {
this.deliveryTime = deliveryTime;
}
public String getExpiryDay() {
return expiryDay;
}
public void setExpiryDay(String expiryDay) {
this.expiryDay = expiryDay;
}
public String getBusinessMembers() { public String getBusinessMembers() {
return businessMembers; return businessMembers;
} }
@ -435,6 +455,8 @@ public class SysSalesOrderChild extends BaseEntity {
.add("materialNoUsdSum", materialNoUsdSum) .add("materialNoUsdSum", materialNoUsdSum)
.add("materialNoRmbSum", materialNoRmbSum) .add("materialNoRmbSum", materialNoRmbSum)
.add("materialRmbSum", materialRmbSum) .add("materialRmbSum", materialRmbSum)
.add("deliveryTime", deliveryTime)
.add("expiryDay", expiryDay)
.add("businessMembers", businessMembers) .add("businessMembers", businessMembers)
.add("confirmTax", confirmTax) .add("confirmTax", confirmTax)
.add("taxRate", taxRate) .add("taxRate", taxRate)

25
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesOrderServiceImpl.java

@ -201,16 +201,23 @@ public class SysSalesOrderServiceImpl implements ISysSalesOrderService
sysSalesOrder.setUpdateBy(loginName); sysSalesOrder.setUpdateBy(loginName);
sysSalesOrder.setUpdateTime(new Date()); sysSalesOrder.setUpdateTime(new Date());
// 存在提交完就流程结束的情况 // 存在提交完就流程结束的情况
if(sysSalesOrder.getSysSalesOrderChildList() != null){ if(sysSalesOrder.getSysSalesOrderChildList().size() > 0){
//1.1.销售订单物料的前台上传新的报价列表,修改后台存在的报价猎豹,以报价编号为索引
//获取传输的销售订单物料报价信息
List<SysSalesOrderChild> sysSalesOrderChildList = sysSalesOrder.getSysSalesOrderChildList(); List<SysSalesOrderChild> sysSalesOrderChildList = sysSalesOrder.getSysSalesOrderChildList();
for (SysSalesOrderChild sysSalesOrderChild:sysSalesOrderChildList) { String[] ids = {sysSalesOrder.getSalesOrderCode()};
if (sysSalesOrderChild.getId() != null && sysSalesOrderChild.getId() != 0){ sysSalesOrderChildService.deleteSysSalesOrderChildByQuoteIds(ids);
sysSalesOrderChildService.updateSysSalesOrderChild(sysSalesOrderChild); //获取已上传的销售订单物料报价信息
}else{ sysSalesOrderChildService.selectSysSalesOrderChildByQuoteId(sysSalesOrder.getSalesOrderCode());
sysSalesOrderChild.setQuoteId(sysSalesOrder.getSalesOrderCode()); for (int i = 0; i < sysSalesOrderChildList.size(); i++) {
sysSalesOrderChildService.insertSysSalesOrderChild(sysSalesOrderChild); SysSalesOrderChild sysSalesOrderChild = sysSalesOrderChildList.get(i);
} sysSalesOrderChild.setQuoteId(sysSalesOrder.getSalesOrderCode());
} sysSalesOrderChild.setCreateBy(loginName);
sysSalesOrderChild.setUpdateBy(loginName);
sysSalesOrderChild.setUpdateTime(new Date());
sysSalesOrderChild.setQuoteId(sysSalesOrder.getSalesOrderCode());
sysSalesOrderChildService.insertSysSalesOrderChild(sysSalesOrderChild);
}
} }
int result = sysSalesOrderMapper.updateSysSalesOrder(sysSalesOrder); int result = sysSalesOrderMapper.updateSysSalesOrder(sysSalesOrder);
return result; return result;

32
ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderChildMapper.xml

@ -27,6 +27,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="materialNoUsdSum" column="materialNoUsdSum" /> <result property="materialNoUsdSum" column="materialNoUsdSum" />
<result property="materialNoRmbSum" column="materialNoRmbSum" /> <result property="materialNoRmbSum" column="materialNoRmbSum" />
<result property="materialRmbSum" column="materialRmbSum" /> <result property="materialRmbSum" column="materialRmbSum" />
<result property="deliveryTime" column="delivery_time" />
<result property="expiryDay" column="expiry_day" />
<result property="outBoundQuantity" column="out_bound_quantity" /> <result property="outBoundQuantity" column="out_bound_quantity" />
<result property="unBoundQuantity" column="un_bound_quantity" /> <result property="unBoundQuantity" column="un_bound_quantity" />
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
@ -42,7 +44,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectSysSalesOrderChild"> <sql id="selectSysSalesOrderChild">
select a.id, a.quoteId, a.materialId, a.materialCode, a.materialName, a.materialType, a.processMethod, a.brand, a.photoUrl,a.unit, a.`describe`, select a.id, a.quoteId, a.materialId, a.materialCode, a.materialName, a.materialType, a.processMethod, a.brand, a.photoUrl,a.unit, a.`describe`,
a.countTax, a.usdTax, a.materialNum,a.materialSole, a.materialRmb, a.materialNoRmb, a.materialNoUsd, a.materialUsd, a.materialUsdSum, a.countTax, a.usdTax, a.materialNum,a.materialSole, a.materialRmb, a.materialNoRmb, a.materialNoUsd, a.materialUsd, a.materialUsdSum,
a.materialNoUsdSum, a.materialNoRmbSum, a.materialRmbSum,a.out_bound_quantity, a.un_bound_quantity, a.create_by, a.create_time, a.update_by, a.materialNoUsdSum, a.materialNoRmbSum, a.materialRmbSum,a.delivery_time, a.expiry_day,
a.out_bound_quantity, a.un_bound_quantity, a.create_by, a.create_time, a.update_by,
a.update_time, a.remark, a.use_status,a.audit_status a.update_time, a.remark, a.use_status,a.audit_status
,b.id as bom_id ,b.id as bom_id
from sys_sales_order_child a from sys_sales_order_child a
@ -54,7 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where> <where>
<if test="quoteId != null and quoteId !='' "> and a.quoteId = #{quoteId}</if> <if test="quoteId != null and quoteId !='' "> and a.quoteId = #{quoteId}</if>
<if test="materialId != null "> and a.materialId = #{materialId}</if> <if test="materialId != null "> and a.materialId = #{materialId}</if>
<if test="materialCode != null and materialCode != ''"> and a.materialCode like concat('%', #{#{materialCode}}, '%')</if> <if test="materialCode != null and materialCode != ''"> and a.materialCode like concat('%', #{materialCode}, '%')</if>
<if test="materialName != null and materialName != ''"> and a.materialName like concat('%', #{materialName}, '%')</if> <if test="materialName != null and materialName != ''"> and a.materialName like concat('%', #{materialName}, '%')</if>
</where> </where>
</select> </select>
@ -91,12 +94,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialNoUsdSum != null">materialNoUsdSum,</if> <if test="materialNoUsdSum != null">materialNoUsdSum,</if>
<if test="materialNoRmbSum != null">materialNoRmbSum,</if> <if test="materialNoRmbSum != null">materialNoRmbSum,</if>
<if test="materialRmbSum != null">materialRmbSum,</if> <if test="materialRmbSum != null">materialRmbSum,</if>
<if test="deliveryTime != null">delivery_time,</if>
<if test="expiryDay != null">expiry_day,</if>
<if test="outBoundQuantity != null">out_bound_quantity,</if> <if test="outBoundQuantity != null">out_bound_quantity,</if>
<if test="unBoundQuantity != null">un_bound_quantity,</if> <if test="unBoundQuantity != null">un_bound_quantity,</if>
<if test="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="remark != null">remark,</if> <if test="remark != null">remark,</if>
<if test="useStatus != null">use_status,</if>
use_status,audit_status,create_time <if test="auditStatus != null">audit_status,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="quoteId != null">#{quoteId},</if> <if test="quoteId != null">#{quoteId},</if>
@ -121,11 +129,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialNoUsdSum != null">#{materialNoUsdSum},</if> <if test="materialNoUsdSum != null">#{materialNoUsdSum},</if>
<if test="materialNoRmbSum != null">#{materialNoRmbSum},</if> <if test="materialNoRmbSum != null">#{materialNoRmbSum},</if>
<if test="materialRmbSum != null">#{materialRmbSum},</if> <if test="materialRmbSum != null">#{materialRmbSum},</if>
<if test="deliveryTime != null">#{deliveryTime},</if>
<if test="expiryDay != null">#{expiryDay},</if>
<if test="outBoundQuantity != null">#{outBoundQuantity},</if> <if test="outBoundQuantity != null">#{outBoundQuantity},</if>
<if test="unBoundQuantity != null">#{unBoundQuantity},</if> <if test="unBoundQuantity != null">#{unBoundQuantity},</if>
<if test="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="remark != null">#{remark},</if> <if test="remark != null">#{remark},</if>
0,0,now() <if test="useStatus != null">#{useStatus},</if>
<if test="auditStatus != null"> #{auditStatus},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim> </trim>
</insert> </insert>
@ -154,17 +168,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialNoUsdSum != null">materialNoUsdSum = #{materialNoUsdSum},</if> <if test="materialNoUsdSum != null">materialNoUsdSum = #{materialNoUsdSum},</if>
<if test="materialNoRmbSum != null">materialNoRmbSum = #{materialNoRmbSum},</if> <if test="materialNoRmbSum != null">materialNoRmbSum = #{materialNoRmbSum},</if>
<if test="materialRmbSum != null">materialRmbSum = #{materialRmbSum},</if> <if test="materialRmbSum != null">materialRmbSum = #{materialRmbSum},</if>
<if test="deliveryTime != null">delivery_time = #{deliveryTime},</if>
<if test="expiryDay != null">expiry_day = #{expiryDay},</if>
<if test="outBoundQuantity != null">out_bound_quantity = #{outBoundQuantity},</if> <if test="outBoundQuantity != null">out_bound_quantity = #{outBoundQuantity},</if>
<if test="unBoundQuantity != null">un_bound_quantity = #{unBoundQuantity},</if> <if test="unBoundQuantity != null">un_bound_quantity = #{unBoundQuantity},</if>
<if test="updateBy != null">update_by = #{updateBy},</if> <if test="updateBy != null">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
<if test="auditStatus != null">audit_status = #{auditStatus},</if> <if test="auditStatus != null">audit_status = #{auditStatus},</if>
<if test="useStatus != null">use_status = #{useStatus},</if> <if test="useStatus != null">use_status = #{useStatus},</if>
update_time = now() <if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
<delete id="deleteSysSalesOrderChildById" parameterType="Long"> <delete id="deleteSysSalesOrderChildById" parameterType="Long">
delete from sys_sales_order_child where id = #{id} delete from sys_sales_order_child where id = #{id}
</delete> </delete>

76
ruoyi-admin/src/main/resources/templates/system/salesOrder/add.html

@ -324,9 +324,8 @@
columns: [ columns: [
{checkbox: true}, {checkbox: true},
{field: 'index',align: 'center', title: "序号", {field: 'index',align: 'center', title: "序号",
formatter: function (value, row, index) { formatter: function (value, row, index,column) {
var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index)); return column;
return columnIndex + $.table.serialNumber(index);
} }
}, },
{title: '物料索引id',field: 'materialId',align: 'center',visible: false}, {title: '物料索引id',field: 'materialId',align: 'center',visible: false},
@ -406,35 +405,38 @@
field: 'materialRmbSum', field: 'materialRmbSum',
align: 'center', align: 'center',
}, },
{ { title: '计划交付时间',
field: 'createBy', field: 'deliveryTime',
align: 'center',
title: '录入人',
visible: false
},
{
field: 'createTime',
align: 'center',
title: '录入时间',
visible: false
},
{
field: 'updateBy',
align: 'center', align: 'center',
title: '更新人', editable: {
visible: false type: 'date',
title: '计划交付时间',
}
}, },
{ {
field: 'updateTime', title: '质保天数',
align: 'center', align: 'center',
title: '上次更新时间', field: 'expiryDay',
visible: false editable: {
type: 'text',
emptytext: "天数",
title: '质保天数',
validate: function (value) { //字段验证
if (!$.trim(value)) {
return '不能为空';
}else{
return value + "天数";
}
}
},
format: function (value, row, index) {
return value + "天数";
}
}, },
{ {
field: 'remark', field: 'remark',
align: 'center', align: 'center',
title: '备注', title: '备注',
visible: false
}, },
{ {
field: 'auditStatus', field: 'auditStatus',
@ -449,7 +451,7 @@
{title: '操作', align: 'center', {title: '操作', align: 'center',
formatter: function (value, row, index) { formatter: function (value, row, index) {
var actions = []; var actions = [];
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a> '); actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + row + '\')"><i class="fa fa-remove"></i>删除</a> ');
return actions.join(''); return actions.join('');
} }
} }
@ -469,7 +471,6 @@
}else{ }else{
usd = Number(usd).toFixed(2); usd = Number(usd).toFixed(2);
} }
console.log(commonCurrency1);
if(commonCurrency1 == 1){ if(commonCurrency1 == 1){
row.materialNoRmb = Number(row.materialNoRmb).toFixed(2); row.materialNoRmb = Number(row.materialNoRmb).toFixed(2);
row.materialRmb = Number(row.materialNoRmb * Number(1 + rmb)); row.materialRmb = Number(row.materialNoRmb * Number(1 + rmb));
@ -656,14 +657,10 @@
}); });
/*业务员列表*/ /*业务员列表*/
//获取单号 //获取单号
$("#form-salesOrder-add").validate({ $("#form-salesOrder-add").validate({focusCleanup: true});
focusCleanup: true
});
function doSubmit(index, layero,uniqueId){ function doSubmit(index, layero,uniqueId){
console.log(uniqueId);
var iframeWin = window[layero.find('iframe')[0]['name']]; var iframeWin = window[layero.find('iframe')[0]['name']];
var rowData = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections')[0]; var rowData = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections')[0];
console.log("rowData: "+rowData);
$("#bootstrap-sub-table-order").bootstrapTable('insertRow', { $("#bootstrap-sub-table-order").bootstrapTable('insertRow', {
index:1, index:1,
row: { row: {
@ -676,10 +673,10 @@
unit: rowData.unit, unit: rowData.unit,
processMethod: rowData.processMethod, processMethod: rowData.processMethod,
photoUrl: rowData.photoUrl, photoUrl: rowData.photoUrl,
countTax: '', countTax: $("#taxRate_add").val(),
usdTax: '', usdTax: $("#usdTax_add").val(),
materialSole: "", materialSole: "",
materialNum: 0, materialNum: 1,
materialNoRmb: 0.00, materialNoRmb: 0.00,
materialNoUsd: 0.00, materialNoUsd: 0.00,
materialRmb: 0.00, materialRmb: 0.00,
@ -715,10 +712,15 @@
$.modal.openOptions(options); $.modal.openOptions(options);
} }
/* 删除指定表格行 */ /* 删除指定表格行 */
function removeRow(index){ function removeRow(){
$("#bootstrap-sub-table-order").bootstrapTable('remove', { var ids = $.table.selectColumns("id");
field: 'index', if (ids.length == 0) {
values: index $.modal.alertWarning("请至少选择一条记录");
return;
}
$("#bootstrap-sub-table-editOrder1").bootstrapTable('remove', {
field: 'id',
values: ids
}) })
} }
function getTotalAmount(){ function getTotalAmount(){

22
ruoyi-admin/src/main/resources/templates/system/salesOrder/detail.html

@ -306,6 +306,7 @@
<i class="fa fa-plus"></i> 添加物料 <i class="fa fa-plus"></i> 添加物料
</a> </a>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-sm-12 select-table table-striped"> <div class="col-sm-12 select-table table-striped">
@ -556,11 +557,8 @@
function queryParams(params) { function queryParams(params) {
var curParams = { var curParams = {
// 传递参数查询参数 // 传递参数查询参数
pageSize: params.limit, quoteId : sysSalesOrder.salesOrderCode
pageNum: params.offset / params.limit + 1, }
quoteId: sysSalesOrder.salesOrderCode,
};
curParams.quoteId = sysSalesOrder.salesOrderCode;
return curParams; return curParams;
} }
/*业务员列表*/ /*业务员列表*/
@ -601,6 +599,7 @@
index: 1, index: 1,
row: { row: {
id:'', id:'',
quoteId:'',
materialId:rowData.id, materialId:rowData.id,
materialCode: rowData.materialNo, materialCode: rowData.materialNo,
materialName: rowData.materialName, materialName: rowData.materialName,
@ -637,10 +636,15 @@
$.modal.openOptions(options); $.modal.openOptions(options);
} }
/* 删除指定表格行 */ /* 删除指定表格行 */
function removeRow(index){ function removeRow(){
$("#bootstrap-sub-table-editOrder").bootstrapTable('remove', { var ids = $.table.selectColumns("id");
field: 'index', if (ids.length == 0) {
value: index $.modal.alertWarning("请至少选择一条记录");
return;
}
$("#bootstrap-sub-table-1").bootstrapTable('remove', {
field: 'id',
values: ids
}) })
} }
$("input[name='pricingDate']").datetimepicker({ $("input[name='pricingDate']").datetimepicker({

198
ruoyi-admin/src/main/resources/templates/system/salesOrder/edit.html

@ -84,8 +84,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required">客户ID:</label> <label class="col-sm-3 control-label is-required">客户ID:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select id="enterpriseCode_edit" name="enterpriseCode" class="form-control m-b" required> <input id="enterpriseCode_edit" th:field="*{enterpriseCode}" name="enterpriseCode" class="form-control m-b" required readonly/>
</select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -103,8 +102,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required">客户联系人:</label> <label class="col-sm-3 control-label is-required">客户联系人:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select id="customerContact_edit" name="customerContact" th:field="*{customerContact}" class="form-control m-b" required> <input id="customerContact_edit" name="customerContact" th:field="*{customerContact}" class="form-control m-b" required readonly />
</select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -122,26 +120,25 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">联系人邮箱:</label> <label class="col-sm-3 control-label">联系人邮箱:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="contactEmail" th:field="*{contactEmail}" class="form-control" type="text" required> <input name="contactEmail" th:field="*{contactEmail}" class="form-control" type="text" required readonly>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required">客户收货人:</label> <label class="col-sm-3 control-label is-required">客户收货人:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select name="customerDelivery" id="customerDelivery_edit" th:field="*{customerDelivery}" class="form-control m-b" > <input name="customerDelivery" id="customerDelivery_edit" th:field="*{customerDelivery}" class="form-control m-b" disabled/>
</select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required">收货人电话:</label> <label class="col-sm-3 control-label is-required">收货人电话:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="deliveryPhone" th:field="*{deliveryPhone}" class="form-control" type="text" /> <input name="deliveryPhone" th:field="*{deliveryPhone}" class="form-control" type="text" disabled/>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required">收货地址:</label> <label class="col-sm-3 control-label is-required">收货地址:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="deliveryAddress" th:field="*{deliveryAddress}" class="form-control" type="text" required> <input name="deliveryAddress" th:field="*{deliveryAddress}" class="form-control" type="text" required disabled>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -153,7 +150,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required">订单类型:</label> <label class="col-sm-3 control-label is-required">订单类型:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select name="salesOrderType" class="form-control" type="text" th:with="dictList=${@dict.getType('sys_order_type')}" required> <select name="salesOrderType" class="form-control" th:field="*{salesOrderType}" th:with="dictList=${@dict.getType('sys_order_type')}" required>
<option value="">请选择</option> <option value="">请选择</option>
<option th:each="dict : ${dictList}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"></option> <option th:each="dict : ${dictList}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"></option>
</select> </select>
@ -163,7 +160,7 @@
<label class="col-sm-3 control-label">接单日期:</label> <label class="col-sm-3 control-label">接单日期:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<div class="input-group date"> <div class="input-group date">
<input name="orderReceivingTime" class="form-control" th:field="*{orderReceivingTime}" placeholder="yyyy-mm-dd" type="text"> <input name="orderReceivingTime" class="form-control" th:value="*{orderReceivingTime}" placeholder="yyyy-mm-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span> <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div> </div>
</div> </div>
@ -175,9 +172,10 @@
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">报价币种:</label> <label class="col-sm-3 control-label is-required">报价币种:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select class="form-control" id="commonCurrency_edit" name="commonCurrency" th:with="dictList=${@dict.getType('sys_common_currency')}" th:field="*{commonCurrency}" required> <select class="form-control" id="commonCurrency_edit" name="commonCurrency"
th:with="dictList=${@dict.getType('sys_common_currency')}" th:field="*{commonCurrency}" required>
<option value="">请选择</option> <option value="">请选择</option>
<option th:each="dict : ${dictList}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"></option> <option th:each="dict : ${dictList}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"></option>
</select> </select>
@ -193,7 +191,7 @@
<label class="col-sm-3 control-label is-required">是否含税:</label> <label class="col-sm-3 control-label is-required">是否含税:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('sys_confirm_tax')}"> <div class="radio-box" th:each="dict : ${@dict.getType('sys_confirm_tax')}">
<input required type="radio" th:id="${'confirmTax_' + dict.dictCode}" <input required type="radio" th:id="${'confirmTax_' + dict.dictCode}" th:field="*{confirmTax}"
name="confirmTax" th:value="${dict.dictValue}"> name="confirmTax" th:value="${dict.dictValue}">
<label th:for="${'confirmTax_' + dict.dictCode}" th:text="${dict.dictLabel}"></label> <label th:for="${'confirmTax_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div> </div>
@ -202,14 +200,14 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">税率:</label> <label class="col-sm-3 control-label">税率:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="taxRate" id="taxRate_edit" th:field="*{taxRate}" class="form-control" type="number"> <input name="taxRate" id="taxRate_edit" th:field="*{taxRate}" class="form-control" type="number" >
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required">是否开票:</label> <label class="col-sm-3 control-label is-required">是否开票:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('sys_whether')}"> <div class="radio-box" th:each="dict : ${@dict.getType('sys_whether')}">
<input required type="radio" th:id="${'invoice_' + dict.dictCode}" <input required type="radio" th:id="${'invoice_' + dict.dictCode}" th:field="*{invoice}"
name="invoice" th:value="${dict.dictValue}"> name="invoice" th:value="${dict.dictValue}">
<label th:for="${'invoice_' + dict.dictCode}" th:text="${dict.dictLabel}"></label> <label th:for="${'invoice_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div> </div>
@ -265,7 +263,7 @@
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">业务员:</label> <label class="col-sm-3 control-label is-required">业务员:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select name="businessMembers" class="form-control m-b" th:field="*{businessMembers}" required> <select name="businessMembers" class="form-control m-b" th:field="*{businessMembers}" required>
</select> </select>
@ -302,11 +300,14 @@
<a class="btn btn-success" onclick="insertRow()"> <a class="btn btn-success" onclick="insertRow()">
<i class="fa fa-plus"></i> 添加物料 <i class="fa fa-plus"></i> 添加物料
</a> </a>
<a class="btn btn-danger" onclick="removeRow()">
<i class="fa fa-plus"></i> 删除物料
</a>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-sm-12 select-table table-striped"> <div class="col-sm-12 select-table table-striped">
<table id="bootstrap-sub-table-editOrder"></table> <table id="bootstrap-table-editOrder"></table>
</div> </div>
</div> </div>
</div> </div>
@ -315,7 +316,6 @@
<th:block th:include="include :: select2-js"/> <th:block th:include="include :: select2-js"/>
<th:block th:include="include :: bootstrap-table-editable-js"/> <th:block th:include="include :: bootstrap-table-editable-js"/>
<th:block th:include="include :: datetimepicker-js" /> <th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: bootstrap-fileinput-js"/>
<script th:inline="javascript"> <script th:inline="javascript">
var prefix = ctx + "system/salesOrder"; var prefix = ctx + "system/salesOrder";
var commonCurrencyDatas = [[${@dict.getType('sys_common_currency')}]]; var commonCurrencyDatas = [[${@dict.getType('sys_common_currency')}]];
@ -327,18 +327,19 @@
$("#form-salesOrder-edit").validate({focusCleanup: true}); $("#form-salesOrder-edit").validate({focusCleanup: true});
$(function() { $(function() {
var options = { var options = {
id:'bootstrap-sub-table-editOrder', id:'bootstrap-table-editOrder',
url: ctx + "system/orderChild/list", url: ctx + "system/orderChild/list",
pagination: false, pagination: false,
queryParams: queryParams, queryParams: queryParams,
sidePagination: "client", sidePagination: "client",
uniqueId: "index",
model: "物料报价信息", model: "物料报价信息",
columns: [ columns: [
{checkbox: true}, {checkbox: true},
{field: 'id',title: '主键id',align: 'center',visible: false},
{field: 'index',align: 'center', title: "序号", {field: 'index',align: 'center', title: "序号",
formatter: function (value, row, index) { formatter: function (value, row, index) {
var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index)); return index + 1;
return columnIndex + $.table.serialNumber(index);
} }
}, },
{title: '物料索引id',field: 'materialId',align: 'center',visible: false}, {title: '物料索引id',field: 'materialId',align: 'center',visible: false},
@ -399,6 +400,18 @@
{ title: '物料的不含税总价(美元)',field: 'materialNoUsdSum',align: 'center'}, { title: '物料的不含税总价(美元)',field: 'materialNoUsdSum',align: 'center'},
{ title: '物料的含税总价(RMB)',field: 'materialNoRmbSum', align: 'center'}, { title: '物料的含税总价(RMB)',field: 'materialNoRmbSum', align: 'center'},
{ title: '物料的不含税总价(RMB)',field: 'materialRmbSum',align: 'center'}, { title: '物料的不含税总价(RMB)',field: 'materialRmbSum',align: 'center'},
{ title: '计划交付时间',field: 'deliveryTime',align: 'center',
editable: {type: 'date',title: '计划交付时间',format: 'yyyy-mm-dd', emptytext: "计划交付时间",
formatter: function (value, row, index) {
return value;
}}
},
{title: '质保天数',align: 'center',field: 'expiryDay',
editable: {type: 'text',emptytext: "天数",title: '质保天数',formatter: function (value, row, index) {
return value + "天数";
}},
},
{ title: '录入人',field: 'createBy',align: 'center',visible: false}, { title: '录入人',field: 'createBy',align: 'center',visible: false},
{ title: '录入时间',field: 'createTime',align: 'center',visible: false}, { title: '录入时间',field: 'createTime',align: 'center',visible: false},
{ title: '更新人',field: 'updateBy',align: 'center',visible: false}, { title: '更新人',field: 'updateBy',align: 'center',visible: false},
@ -412,7 +425,7 @@
{title: '操作', align: 'center', {title: '操作', align: 'center',
formatter: function (value, row, index) { formatter: function (value, row, index) {
var actions = []; var actions = [];
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + row.index + '\')"><i class="fa fa-remove"></i>删除</a> '); actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + index + '\')"><i class="fa fa-remove"></i>删除</a> ');
return actions.join(''); return actions.join('');
} }
} }
@ -420,60 +433,62 @@
onEditableSave:function(field, row, oldValue, $el){ onEditableSave:function(field, row, oldValue, $el){
var commonCurrency1 = $("#commonCurrency_edit option:selected").val(); var commonCurrency1 = $("#commonCurrency_edit option:selected").val();
var rmb1 = $("#taxRate_edit").val(); var rmb1 = $("#taxRate_edit").val();
if (rmb1 =='' || rmb1== null){ if (rmb1== null){
rmb1 = 0; rmb1 = 0;
}else{ }else{
rmb1 = $("#taxRate_edit").val(); rmb1 = $("#taxRate_edit").val();
} }
var rmb = Number(rmb1).toFixed(2) / 100; var rmb = parseFloat(rmb1).toFixed(2) / 100;
var usd = $("#usdTax_edit").val(); var usd = $("#usdTax_edit").val();
if (usd =='' || usd== null){ if (usd== null){
usd = 0; usd = 0;
}else{ }else{
usd = Number(usd).toFixed(2); usd = parseFloat(usd).toFixed(2);
} }
if(commonCurrency1 == 1){ if(commonCurrency1 == 1){
row.materialNoRmb = Number(row.materialNoRmb).toFixed(2); row.materialNoRmb = parseFloat(row.materialNoRmb).toFixed(2);
row.materialRmb = Number(row.materialNoRmb * Number(1 + rmb)); row.materialRmb = parseFloat(row.materialNoRmb * parseFloat(1 + rmb));
row.materialNoRmbSum = Number(row.materialNum * Number(row.materialNoRmb)).toFixed(2); row.materialNoRmbSum = parseFloat(row.materialNum * parseFloat(row.materialNoRmb)).toFixed(2);
row.materialRmbSum = Number(row.materialRmb * row.materialNum).toFixed(2); row.materialRmbSum = parseFloat(row.materialRmb * row.materialNum).toFixed(2);
row.materialNoUsd = Number(row.materialNoRmb / usd).toFixed(2); row.materialNoUsd = parseFloat(row.materialNoRmb / usd).toFixed(2);
row.materialNoUsdSum = Number(row.materialNum * row.materialNoUsd).toFixed(2); row.materialNoUsdSum = parseFloat(row.materialNum * row.materialNoUsd).toFixed(2);
row.materialUsd = Number(row.materialNoUsd).toFixed(2) row.materialUsd = parseFloat(row.materialNoUsd).toFixed(2)
row.materialUsdSum = Number(row.materialNum * Number(row.materialUsd)).toFixed(2); row.materialUsdSum = parseFloat(row.materialNum * parseFloat(row.materialUsd)).toFixed(2);
} }
else if( commonCurrency1 == 2){ else if( commonCurrency1 == 2){
row.materialNoUsd = Number(row.materialNoUsd).toFixed(2); row.materialNoUsd = parseFloat(row.materialNoUsd).toFixed(2);
row.materialUsd = Number(row.materialNoUsd).toFixed(2); row.materialUsd = parseFloat(row.materialNoUsd).toFixed(2);
row.materialUsdSum = Number(row.materialNum * row.materialUsd).toFixed(2); row.materialUsdSum = parseFloat(row.materialNum * row.materialUsd).toFixed(2);
row.materialNoUsdSum = Number(row.materialNoUsd * row.materialNum).toFixed(2); row.materialNoUsdSum = parseFloat(row.materialNoUsd * row.materialNum).toFixed(2);
row.materialNoRmb = Number(row.materialNoUsd * usd).toFixed(2); row.materialNoRmb = parseFloat(row.materialNoUsd * usd).toFixed(2);
row.materialRmb = Number(row.materialNoRmb * (1 + rmb)).toFixed(2); row.materialRmb = parseFloat(row.materialNoRmb * (1 + rmb)).toFixed(2);
row.materialNoRmbSum = Number(row.materialNoRmb * row.materialNum).toFixed(2); row.materialNoRmbSum = parseFloat(row.materialNoRmb * row.materialNum).toFixed(2);
row.materialRmbSum = Number(row.materialRmb * row.materialNum).toFixed(2); row.materialRmbSum = parseFloat(row.materialRmb * row.materialNum).toFixed(2);
} }
getTotalAmount() getTotalAmount()
}, },
}; };
$.table.init(options); $.table.init(options);
});
$(function(){
$.ajax({ $.ajax({
type: "post", type: "post",
url:ctx + "system/customer/customerList", url:ctx + "system/customer/customerList",
dataType:"json", dataType:"json",
delay:250, delay:250,
cache:true, cache:true,
success: function (res, params) { success: function (res, params) {
if (res.rows.length > 0) { if (res.rows.length > 0) {
var result = res.rows; var result = res.rows;
for (let i in result) { for (let i in result) {
$("#form-salesOrder-edit select[name='enterpriseCode']").append( $("#form-salesOrder-edit select[name='enterpriseCode']").append(
"<option value='" + result[i].enterpriseCode + "'>" + result[i].enterpriseCode + "</option>"); "<option value='" + result[i].enterpriseCode + "'>" + result[i].enterpriseCode + "</option>");
}
$("#form-salesOrder-edit select[name='enterpriseCode']").val(sysSalesOrder.enterpriseCode).trigger("change");
} else {
$.modal.msgError(res.msg);
} }
}, $("#form-salesOrder-edit select[name='enterpriseCode']").val(sysSalesOrder.enterpriseCode).trigger("change");
} else {
$.modal.msgError(res.msg);
}
},
}); });
$.ajax({ $.ajax({
type: "post", type: "post",
@ -544,7 +559,7 @@
$("#usd_edit").val(Number(sysSalesOrder.usd).toFixed(2)); $("#usd_edit").val(Number(sysSalesOrder.usd).toFixed(2));
$("#noUsdSum_edit").val(Number(sysSalesOrder.noUsdSum).toFixed(2)); $("#noUsdSum_edit").val(Number(sysSalesOrder.noUsdSum).toFixed(2));
$("#usdSum_edit").val(Number(sysSalesOrder.usdSum).toFixed(2)); $("#usdSum_edit").val(Number(sysSalesOrder.usdSum).toFixed(2));
}); })
$('#enterpriseCode_edit').on('select2:select', function (e) { $('#enterpriseCode_edit').on('select2:select', function (e) {
var data = e.params.data; var data = e.params.data;
$("input[name='enterpriseName']").val(data.enterpriseName); $("input[name='enterpriseName']").val(data.enterpriseName);
@ -580,23 +595,15 @@
function doSubmit(index, layero,uniqueId){ function doSubmit(index, layero,uniqueId){
var iframeWin = window[layero.find('iframe')[0]['name']]; var iframeWin = window[layero.find('iframe')[0]['name']];
var rowData = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections')[0]; var rowData = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections')[0];
console.log("rowData:"+rowData);
var totalNum = $("#bootstrap-select-table").bootstrapTable('getData').length; var totalNum = $("#bootstrap-select-table").bootstrapTable('getData').length;
var rmb1 = $("#taxRate_edit").val(); var rmb1 = $("#taxRate_edit").val();
if (rmb1 =='' || rmb1== null){ if (rmb1== null){
rmb1 = 0; rmb1 = 0;
}else{
rmb1 = $("#taxRate_edit").val();
} }
var rmb = Number(rmb1).toFixed(2) / 100; var rmb = parseFloat(rmb1).toFixed(2) / 100;
var usd = $("#usdTax_edit").val(); var usd = $("#usdTax_edit").val()!=null?Number(usd).toFixed(2):0;
if (usd =='' || usd== null){ $("#bootstrap-table-editOrder").bootstrapTable('insertRow', {
usd = 0; index: totalNum,
}else{
usd = Number(usd).toFixed(2);
}
$("#bootstrap-sub-table-editOrder").bootstrapTable('insertRow', {
index: 1,
row: { row: {
id:'', id:'',
materialId:rowData.id, materialId:rowData.id,
@ -608,7 +615,7 @@
photoUrl: rowData.photoUrl, photoUrl: rowData.photoUrl,
unit: rowData.unit, unit: rowData.unit,
processMethod: rowData.processMethod, processMethod: rowData.processMethod,
countTax:rmb1 , countTax:rmb ,
usdTax: usd, usdTax: usd,
materialSole: rowData.materialSole, materialSole: rowData.materialSole,
materialNum: 0.00, materialNum: 0.00,
@ -635,52 +642,35 @@
$.modal.openOptions(options); $.modal.openOptions(options);
} }
/* 删除指定表格行 */ /* 删除指定表格行 */
function removeRow(index){ function removeRow(){
$("#bootstrap-sub-table-editOrder").bootstrapTable('remove', { var ids = $.table.selectColumns("id");
field: 'index', if (ids.length == 0) {
value: index $.modal.alertWarning("请至少选择一条记录");
return;
}
$("#bootstrap-table-editOrder").bootstrapTable('remove', {
field: 'id',
values: ids
}) })
} }
$("input[name='pricingDate']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$("input[name='deliveryTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$("input[name='orderReceivingTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$("input[name='modificationTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
function submitHandler() { function submitHandler() {
if ($.validate.form()) { if ($.validate.form()) {
var formData = $("#form-salesOrder-edit").serializeArray(); var formData = $("#form-salesOrder-edit").serializeArray();
var tableData = $("#bootstrap-sub-table-editOrder").bootstrapTable('getData'); var tableData = $("#bootstrap-table-editOrder").bootstrapTable('getData');
var rows = tableData.length; var rows = tableData.length;
if(rows==0){ if(rows==0){
$.modal.alertWarning("子表数据不能为空!"); $.modal.alertWarning("子表数据不能为空!");
}else{ }else{
formData.push({"name": "sysSalesOrderChildList", "value": tableData}); formData.push({"name": "sysSalesOrderChildList", "value": tableData});
var jsonData = $.common.formDataToJson(formData); var jsonData = $.common.formDataToJson(formData);
console.log("jsonData");
console.log(jsonData);
$.operate.saveJson(prefix + "/edit", jsonData); $.operate.saveJson(prefix + "/edit", jsonData);
} }
} }
} }
//计算 //计算
function getTotalAmount(){ function getTotalAmount(){
// $("#addFinishbomTable").bootstrapTable('refresh'); let getData = $("#bootstrap-table-editOrder").bootstrapTable('getData');
let getData = $("#bootstrap-sub-table-order").bootstrapTable('getData');
let enterprise = 0;let enterpriseSum = 0; let noRmb = 0; let enterprise = 0;let enterpriseSum = 0; let noRmb = 0;
let rmb = 0;let noRmbSum =0;let rmbSum = 0; let rmb = 0;let noRmbSum =0;let rmbSum = 0;
let noUsd = 0;let usd = 0;let noUsdSum =0; let usdSum = 0; let noUsd = 0;let usd = 0;let noUsdSum =0; let usdSum = 0;
@ -696,7 +686,7 @@
$("input[name='usdTaxSum']").val(0); $("input[name='usdTaxSum']").val(0);
for(let i=0;i<getData.length;i++){ for(let i=0;i<getData.length;i++){
enterprise += 1; enterprise += 1;
enterpriseSum = parseInt(enterprise + getData[i].materialNum); enterpriseSum = parseInt(enterprise + getData[i].materialNum).toFixed(0);
noRmb = parseFloat(noRmb + getData[i].materialNoRmb).toFixed(2); noRmb = parseFloat(noRmb + getData[i].materialNoRmb).toFixed(2);
rmb = parseFloat(rmb + getData[i].materialRmb).toFixed(2) ; rmb = parseFloat(rmb + getData[i].materialRmb).toFixed(2) ;
noRmbSum = parseFloat(noRmbSum + getData[i].materialNoRmbSum).toFixed(2); noRmbSum = parseFloat(noRmbSum + getData[i].materialNoRmbSum).toFixed(2);

Loading…
Cancel
Save