@@ -611,7 +611,6 @@
|
||||
|
||||
//增加
|
||||
function addAccountHead(){
|
||||
$("#clientIp").val(clientIp);
|
||||
$('#accountHeadFM').form('clear');
|
||||
var thisDateTime = getNowFormatDateTime(); //当前时间
|
||||
$("#BillTime").val(thisDateTime);
|
||||
@@ -643,7 +642,6 @@
|
||||
//编辑信息
|
||||
function editAccountHead(accountHeadTotalInfo){
|
||||
var accountHeadInfo = accountHeadTotalInfo.split("AaBb");
|
||||
$("#clientIp").val(clientIp);
|
||||
$("#BillNo").val(accountHeadInfo[1]);
|
||||
$("#BillTime").val(accountHeadInfo[2]);
|
||||
$("#Remark").val(accountHeadInfo[3]);
|
||||
|
||||
@@ -1523,7 +1523,6 @@
|
||||
|
||||
//新增信息
|
||||
function addDepotHead(){
|
||||
$("#clientIp").val(clientIp);
|
||||
$('#depotHeadFM').form('clear');
|
||||
var thisDateTime = getNowFormatDateTime(); //当前时间
|
||||
$("#OperTime").val(thisDateTime);
|
||||
@@ -1625,7 +1624,6 @@
|
||||
return;
|
||||
}
|
||||
var depotHeadInfo = depotHeadTotalInfo.split("AaBb");
|
||||
$("#clientIp").val(clientIp);
|
||||
if(listSubType==="礼品销售"){
|
||||
$("#GiftId").combobox('setValue',depotHeadInfo[1]);
|
||||
}
|
||||
|
||||
@@ -68,12 +68,12 @@
|
||||
<td style="padding:5px;width:170px;">
|
||||
<input type="text" name="BillTime" id="BillTime"
|
||||
onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="txt Wdate"
|
||||
style="width:140px;"/>
|
||||
style="width:140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:80px;">单据编号:</td>
|
||||
<td style="padding:5px;width:170px;">
|
||||
<input name="BillNo" id="BillNo" class="easyui-validatebox"
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 140px;"/>
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
@@ -97,7 +97,6 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="hidden" name="clientIp" id="clientIp" value="<%=clientIp %>"/>
|
||||
</form>
|
||||
</div>
|
||||
<div id="dlg-buttons">
|
||||
|
||||
@@ -64,12 +64,12 @@
|
||||
<td style="padding:5px;width:170px;">
|
||||
<input type="text" name="BillTime" id="BillTime"
|
||||
onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="txt Wdate"
|
||||
style="width:140px;"/>
|
||||
style="width:140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:80px;">单据编号:</td>
|
||||
<td style="padding:5px;width:170px;">
|
||||
<input name="BillNo" id="BillNo" class="easyui-validatebox"
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 140px;"/>
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:70px;"></td>
|
||||
<td style="padding:5px">
|
||||
|
||||
@@ -68,12 +68,12 @@
|
||||
<td style="padding:5px;width:170px;">
|
||||
<input type="text" name="BillTime" id="BillTime"
|
||||
onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="txt Wdate"
|
||||
style="width:140px;"/>
|
||||
style="width:140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:70px;">单据编号:</td>
|
||||
<td style="padding:5px;width:170px;">
|
||||
<input name="BillNo" id="BillNo" class="easyui-validatebox"
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 140px;"/>
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
|
||||
@@ -68,12 +68,12 @@
|
||||
<td style="padding:5px;width:170px;">
|
||||
<input type="text" name="BillTime" id="BillTime"
|
||||
onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="txt Wdate"
|
||||
style="width:140px;"/>
|
||||
style="width:140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:70px;">单据编号:</td>
|
||||
<td style="padding:5px;width:170px;">
|
||||
<input name="BillNo" id="BillNo" class="easyui-validatebox"
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 140px;"/>
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
|
||||
@@ -68,12 +68,12 @@
|
||||
<td style="padding:5px;width:170px;">
|
||||
<input type="text" name="BillTime" id="BillTime"
|
||||
onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="txt Wdate"
|
||||
style="width:140px;"/>
|
||||
style="width:140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:70px;">单据编号:</td>
|
||||
<td style="padding:5px;width:170px;">
|
||||
<input name="BillNo" id="BillNo" class="easyui-validatebox"
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 140px;"/>
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
|
||||
@@ -67,12 +67,12 @@
|
||||
<td style="width:70px;">单据日期:</td>
|
||||
<td style="padding:5px;width:170px;">
|
||||
<input type="text" name="BillTime" id="BillTime" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})"
|
||||
class="txt Wdate" style="width:140px;"/>
|
||||
class="txt Wdate" style="width:140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:70px;">单据编号:</td>
|
||||
<td style="padding:5px;width:170px;">
|
||||
<input name="BillNo" id="BillNo" class="easyui-validatebox"
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 140px;"/>
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
|
||||
@@ -105,7 +105,6 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="hidden" name="clientIp" id="clientIp" value="<%=clientIp %>"/>
|
||||
</form>
|
||||
</div>
|
||||
<div id="dlg-buttons">
|
||||
|
||||
@@ -65,12 +65,12 @@
|
||||
<td style="padding:5px;width:170px;">
|
||||
<input type="text" name="OperTime" id="OperTime"
|
||||
onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="txt Wdate"
|
||||
style="width:140px;"/>
|
||||
style="width:140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:70px;">单据编号:</td>
|
||||
<td style="padding:5px">
|
||||
<input name="Number" id="Number" class="easyui-validatebox"
|
||||
data-options="required:true,validType:'length[2,30]'" style="width:140px;"/>
|
||||
data-options="required:true,validType:'length[2,30]'" style="width:140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:80px;"></td>
|
||||
<td style="padding:5px;width:170px;"></td>
|
||||
|
||||
@@ -16,11 +16,6 @@
|
||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||
<script src="/js/common/common.js"></script>
|
||||
<script src="/js/pages/materials/in_out.js"></script>
|
||||
<script>
|
||||
var kid = ${sessionScope.user.id};
|
||||
var path = "<%=path%>";
|
||||
var clientIp = "<%=clientIp%>";
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 查询 -->
|
||||
@@ -70,12 +65,12 @@
|
||||
<td style="padding:5px;width:170px;">
|
||||
<input type="text" name="OperTime" id="OperTime"
|
||||
onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="txt Wdate"
|
||||
style="width:140px;"/>
|
||||
style="width:140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:70px;">单据编号:</td>
|
||||
<td style="padding:5px">
|
||||
<input name="Number" id="Number" class="easyui-validatebox"
|
||||
data-options="required:true,validType:'length[2,30]'" style="width:140px;"/>
|
||||
data-options="required:true,validType:'length[2,30]'" style="width:140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:80px;"></td>
|
||||
<td style="padding:5px;width:170px;"></td>
|
||||
@@ -96,7 +91,6 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="hidden" name="clientIp" id="clientIp" value="<%=clientIp %>"/>
|
||||
</form>
|
||||
</div>
|
||||
<div id="dlg-buttons">
|
||||
|
||||
@@ -70,12 +70,12 @@
|
||||
<td style="padding:5px;width:170px;">
|
||||
<input type="text" name="OperTime" id="OperTime"
|
||||
onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="txt Wdate"
|
||||
style="width:140px;"/>
|
||||
style="width:140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:70px;">单据编号:</td>
|
||||
<td style="padding:5px">
|
||||
<input name="Number" id="Number" class="easyui-validatebox"
|
||||
data-options="required:true,validType:'length[2,30]'" style="width:140px;"/>
|
||||
data-options="required:true,validType:'length[2,30]'" style="width:140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:80px;"></td>
|
||||
<td style="padding:5px;width:170px;"></td>
|
||||
|
||||
@@ -65,12 +65,12 @@
|
||||
<td style="padding:5px">
|
||||
<input type="text" name="OperTime" id="OperTime"
|
||||
onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="txt Wdate"
|
||||
style="width:140px;"/>
|
||||
style="width:140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:70px;">单据编号:</td>
|
||||
<td style="padding:5px">
|
||||
<input name="Number" id="Number" class="easyui-validatebox"
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 140px;"/>
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 140px;" readonly/>
|
||||
</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
@@ -91,7 +91,6 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="hidden" name="clientIp" id="clientIp" value="<%=clientIp %>"/>
|
||||
</form>
|
||||
</div>
|
||||
<div id="dlg-buttons">
|
||||
|
||||
@@ -65,12 +65,12 @@
|
||||
<td style="padding:5px">
|
||||
<input type="text" name="OperTime" id="OperTime"
|
||||
onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="txt Wdate"
|
||||
style="width: 140px;"/>
|
||||
style="width: 140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:70px;">单据编号:</td>
|
||||
<td style="padding:5px">
|
||||
<input name="Number" id="Number" class="easyui-validatebox"
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 140px;"/>
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 140px;" readonly/>
|
||||
</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
|
||||
@@ -75,12 +75,12 @@
|
||||
<td style="padding:5px">
|
||||
<input type="text" name="OperTime" id="OperTime"
|
||||
onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="txt Wdate"
|
||||
style="width:140px;"/>
|
||||
style="width:140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:80px;">单据编号:</td>
|
||||
<td style="padding:5px">
|
||||
<input name="Number" id="Number" class="easyui-validatebox"
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 140px;"/>
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:70px;"></td>
|
||||
<td style="padding:5px">
|
||||
@@ -100,7 +100,6 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="hidden" name="clientIp" id="clientIp" value="<%=clientIp %>"/>
|
||||
</form>
|
||||
</div>
|
||||
<div id="dlg-buttons">
|
||||
|
||||
@@ -69,12 +69,12 @@
|
||||
<td style="padding:5px">
|
||||
<input type="text" name="OperTime" id="OperTime"
|
||||
onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="txt Wdate"
|
||||
style="width:140px;"/>
|
||||
style="width:140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:80px;">单据编号:</td>
|
||||
<td style="padding:5px">
|
||||
<input name="Number" id="Number" class="easyui-validatebox"
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 140px;"/>
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:70px;"></td>
|
||||
<td style="padding:5px">
|
||||
@@ -94,7 +94,6 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="hidden" name="clientIp" id="clientIp" value="<%=clientIp %>"/>
|
||||
</form>
|
||||
</div>
|
||||
<div id="dlg-buttons">
|
||||
|
||||
@@ -75,12 +75,12 @@
|
||||
<td style="padding:5px">
|
||||
<input type="text" name="OperTime" id="OperTime"
|
||||
onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="txt Wdate"
|
||||
style="width:140px;"/>
|
||||
style="width:140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:80px;">单据编号:</td>
|
||||
<td style="padding:5px">
|
||||
<input name="Number" id="Number" class="easyui-validatebox"
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 140px;"/>
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:70px;"></td>
|
||||
<td style="padding:5px">
|
||||
|
||||
@@ -75,12 +75,12 @@
|
||||
<td style="padding:5px">
|
||||
<input type="text" name="OperTime" id="OperTime"
|
||||
onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="txt Wdate"
|
||||
style="width:140px;"/>
|
||||
style="width:140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:80px;">单据编号:</td>
|
||||
<td style="padding:5px">
|
||||
<input name="Number" id="Number" class="easyui-validatebox"
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 140px;"/>
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:70px;"></td>
|
||||
<td style="padding:5px">
|
||||
|
||||
@@ -69,12 +69,12 @@
|
||||
<td style="padding:5px">
|
||||
<input type="text" name="OperTime" id="OperTime"
|
||||
onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="txt Wdate"
|
||||
style="width: 140px;"/>
|
||||
style="width: 140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:80px;">单据编号:</td>
|
||||
<td style="padding:5px">
|
||||
<input name="Number" id="Number" class="easyui-validatebox"
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 140px;"/>
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:70px;"></td>
|
||||
<td style="padding:5px;width:150px;"></td>
|
||||
|
||||
@@ -69,12 +69,12 @@
|
||||
<td style="padding:5px">
|
||||
<input type="text" name="OperTime" id="OperTime"
|
||||
onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="txt Wdate"
|
||||
style="width: 140px;"/>
|
||||
style="width: 140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:80px;">单据编号:</td>
|
||||
<td style="padding:5px">
|
||||
<input name="Number" id="Number" class="easyui-validatebox"
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 140px;"/>
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:70px;">付款类型:</td>
|
||||
<td style="padding:5px;width:150px;">
|
||||
|
||||
@@ -73,12 +73,12 @@
|
||||
<td style="padding:5px">
|
||||
<input type="text" name="OperTime" id="OperTime"
|
||||
onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="txt Wdate"
|
||||
style="width:140px;"/>
|
||||
style="width:140px;" readonly/>
|
||||
</td>
|
||||
<td>单据编号:</td>
|
||||
<td style="padding:5px">
|
||||
<input name="Number" id="Number" class="easyui-validatebox"
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 140px;"/>
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
@@ -136,7 +136,6 @@
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="hidden" name="clientIp" id="clientIp" value="<%=clientIp %>"/>
|
||||
</form>
|
||||
</div>
|
||||
<div id="dlg-buttons">
|
||||
|
||||
@@ -73,12 +73,12 @@
|
||||
<td style="padding:5px">
|
||||
<input type="text" name="OperTime" id="OperTime"
|
||||
onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="txt Wdate"
|
||||
style="width:140px;"/>
|
||||
style="width:140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:70px;">单据编号:</td>
|
||||
<td style="padding:5px">
|
||||
<input name="Number" id="Number" class="easyui-validatebox"
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 140px;"/>
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 140px;" readonly/>
|
||||
</td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
@@ -138,7 +138,6 @@
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="hidden" name="clientIp" id="clientIp" value="<%=clientIp %>"/>
|
||||
</form>
|
||||
</div>
|
||||
<div id="dlg-buttons">
|
||||
|
||||
@@ -5253,8 +5253,8 @@ ALTER TABLE jsh_depotitem DROP FOREIGN KEY jsh_depotitem_ibfk_1;
|
||||
DROP TABLE IF EXISTS `tbl_sequence`;
|
||||
CREATE TABLE tbl_sequence (
|
||||
seq_name VARCHAR(50) NOT NULL COMMENT '序列名称',
|
||||
minvalue bigint(20) NOT NULL COMMENT '最小值',
|
||||
maxvalue bigint(20) NOT NULL COMMENT '最大值',
|
||||
min_value bigint(20) NOT NULL COMMENT '最小值',
|
||||
max_value bigint(20) NOT NULL COMMENT '最大值',
|
||||
current_val bigint(20) NOT NULL COMMENT '当前值',
|
||||
increment_val INT DEFAULT '1' NOT NULL COMMENT '增长步数',
|
||||
remark VARCHAR(500) DEFAULT null COMMENT '备注',
|
||||
@@ -5264,7 +5264,7 @@ CREATE TABLE tbl_sequence (
|
||||
-- ----------------------------
|
||||
-- 添加表单据编号sequence
|
||||
-- ----------------------------
|
||||
insert into tbl_sequence (seq_name, minvalue, maxvalue, current_val, increment_val,remark) values ('depot_number_seq', 1, 999999999999999999, 1, 1,'单据编号sequence');
|
||||
insert into tbl_sequence (seq_name, min_value, max_value, current_val, increment_val,remark) values ('depot_number_seq', 1, 999999999999999999, 1, 1,'单据编号sequence');
|
||||
-- ----------------------------
|
||||
-- 创建function _nextval() 用于获取当前序列号
|
||||
-- ----------------------------
|
||||
@@ -5276,7 +5276,7 @@ declare _cur bigint;
|
||||
declare _maxvalue bigint; -- 接收最大值
|
||||
declare _increment int; -- 接收增长步数
|
||||
set _increment = (select increment_val from tbl_sequence where seq_name = name);
|
||||
set _maxvalue = (select maxvalue from tbl_sequence where seq_name = name);
|
||||
set _maxvalue = (select max_value from tbl_sequence where seq_name = name);
|
||||
set _cur = (select current_val from tbl_sequence where seq_name = name for update);
|
||||
update tbl_sequence -- 更新当前值
|
||||
set current_val = _cur + increment_val
|
||||
|
||||
Binary file not shown.
@@ -315,20 +315,25 @@ public class DepotHeadService {
|
||||
//判断用户是否已经登录过,登录过不再处理
|
||||
User userInfo=userService.getCurrentUser();
|
||||
depotHead.setOperpersonname(userInfo==null?null:userInfo.getUsername());
|
||||
//构造新的编号
|
||||
String dNumber = depotHead.getDefaultnumber();
|
||||
String number = dNumber.substring(0, 12); //截取前缀
|
||||
String beginTime = Tools.getNow() + " 00:00:00";
|
||||
String endTime = Tools.getNow() + " 23:59:59";
|
||||
String newNumber = buildNumber(depotHead.getType(), depotHead.getSubtype(), beginTime, endTime); //从数据库查询最新的编号+1,这样能防止重复
|
||||
String allNewNumber = number + newNumber;
|
||||
String frontNumber = depotHead.getNumber();
|
||||
if(frontNumber.indexOf(number) > -1) {
|
||||
depotHead.setNumber(allNewNumber); //从后台取值
|
||||
} else {
|
||||
depotHead.setNumber(frontNumber); //从前端文本框里面获取
|
||||
}
|
||||
depotHead.setDefaultnumber(allNewNumber); //初始编号,一直都从后台取值
|
||||
/**
|
||||
* 2019-02-02
|
||||
* 使用最新生成的唯一单据编号,理论上可以保证唯一性
|
||||
* 保存时就不再加判断,提高程序的效率
|
||||
* */
|
||||
// //构造新的编号
|
||||
// String dNumber = depotHead.getDefaultnumber();
|
||||
// String number = dNumber.substring(0, 12); //截取前缀
|
||||
// String beginTime = Tools.getNow() + " 00:00:00";
|
||||
// String endTime = Tools.getNow() + " 23:59:59";
|
||||
// String newNumber = buildNumber(depotHead.getType(), depotHead.getSubtype(), beginTime, endTime); //从数据库查询最新的编号+1,这样能防止重复
|
||||
// String allNewNumber = number + newNumber;
|
||||
// String frontNumber = depotHead.getNumber();
|
||||
// if(frontNumber.indexOf(number) > -1) {
|
||||
// depotHead.setNumber(allNewNumber); //从后台取值
|
||||
// } else {
|
||||
// depotHead.setNumber(frontNumber); //从前端文本框里面获取
|
||||
// }
|
||||
// depotHead.setDefaultnumber(allNewNumber); //初始编号,一直都从后台取值
|
||||
depotHead.setCreatetime(new Timestamp(System.currentTimeMillis()));
|
||||
depotHead.setStatus(false);
|
||||
depotHeadMapperEx.adddepotHead(depotHead);
|
||||
@@ -396,7 +401,8 @@ public class DepotHeadService {
|
||||
/**回收序列号*/
|
||||
if(depotItemList!=null&&depotItemList.size()>0){
|
||||
for(DepotItem depotItem:depotItemList){
|
||||
serialNumberService.cancelSerialNumber(depotItem.getMaterialid(), depotItem.getHeaderid(),depotItem.getOpernumber().intValue(),userInfo);
|
||||
//BasicNumber=OperNumber*ratio
|
||||
serialNumberService.cancelSerialNumber(depotItem.getMaterialid(), depotItem.getHeaderid(),depotItem.getBasicnumber().intValue(),userInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,7 +224,11 @@ public class DepotItemService {
|
||||
return depotItemMapperEx.findGiftByTypeOut(subType, ProjectId, MId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 2019-02-02修改
|
||||
* 我之前对操作数量的理解有偏差
|
||||
* 这里重点重申一下:BasicNumber=OperNumber*ratio
|
||||
* */
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public String saveDetials(String inserted, String deleted, String updated, Long headerId) throws Exception{
|
||||
//查询单据主表信息
|
||||
@@ -259,7 +263,7 @@ public class DepotItemService {
|
||||
continue;
|
||||
}
|
||||
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableSerialNumber())){
|
||||
serialNumberMapperEx.cancelSerialNumber(depotItem.getMaterialid(),depotItem.getHeaderid(),depotItem.getOpernumber().intValue(),
|
||||
serialNumberMapperEx.cancelSerialNumber(depotItem.getMaterialid(),depotItem.getHeaderid(),depotItem.getBasicnumber().intValue(),
|
||||
new Date(),userInfo==null?null:userInfo.getId());
|
||||
}
|
||||
}
|
||||
@@ -279,14 +283,18 @@ public class DepotItemService {
|
||||
String Unit = tempInsertedJson.get("Unit").toString();
|
||||
BigDecimal oNumber = tempInsertedJson.getBigDecimal("OperNumber");
|
||||
Long mId = Long.parseLong(tempInsertedJson.get("MaterialId").toString());
|
||||
/***
|
||||
* 为什么调用的方法要先把基础单位去掉,去掉之后后续还能获取到?
|
||||
* */
|
||||
//以下进行单位换算
|
||||
String UnitName = findUnitName(mId); //查询计量单位名称
|
||||
if (!StringUtil.isEmpty(UnitName)) {
|
||||
String UnitList = UnitName.substring(0, UnitName.indexOf("("));
|
||||
String RatioList = UnitName.substring(UnitName.indexOf("("));
|
||||
String basicUnit = UnitList.substring(0, UnitList.indexOf(",")); //基本单位
|
||||
String otherUnit = UnitList.substring(UnitList.indexOf(",") + 1); //副单位
|
||||
Integer ratio = Integer.parseInt(RatioList.substring(RatioList.indexOf(":") + 1).replace(")", "")); //比例
|
||||
// String UnitName = findUnitName(mId); //查询计量单位名称
|
||||
String unitName = materialService.findUnitName(mId);
|
||||
if (!StringUtil.isEmpty(unitName)) {
|
||||
String unitList = unitName.substring(0, unitName.indexOf("("));
|
||||
String ratioList = unitName.substring(unitName.indexOf("("));
|
||||
String basicUnit = unitList.substring(0, unitList.indexOf(",")); //基本单位
|
||||
String otherUnit = unitList.substring(unitList.indexOf(",") + 1); //副单位
|
||||
Integer ratio = Integer.parseInt(ratioList.substring(ratioList.indexOf(":") + 1).replace(")", "")); //比例
|
||||
if (Unit.equals(basicUnit)) { //如果等于基础单位
|
||||
depotItem.setBasicnumber(oNumber); //数量一致
|
||||
} else if (Unit.equals(otherUnit)) { //如果等于副单位
|
||||
@@ -353,7 +361,7 @@ public class DepotItemService {
|
||||
if(material==null){
|
||||
continue;
|
||||
}
|
||||
if(getCurrentInStock(depotItem.getMaterialid())<depotItem.getOpernumber().intValue()){
|
||||
if(getCurrentInStock(depotItem.getMaterialid())<depotItem.getBasicnumber().intValue()){
|
||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_CODE,
|
||||
String.format(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_MSG,material==null?"":material.getName()));
|
||||
}
|
||||
@@ -391,9 +399,13 @@ public class DepotItemService {
|
||||
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
|
||||
* */
|
||||
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableSerialNumber())) {
|
||||
serialNumberMapperEx.cancelSerialNumber(depotItem.getMaterialid(), depotItem.getHeaderid(), depotItem.getOpernumber().intValue(),
|
||||
serialNumberMapperEx.cancelSerialNumber(depotItem.getMaterialid(), depotItem.getHeaderid(), depotItem.getBasicnumber().intValue(),
|
||||
new Date(), userInfo == null ? null : userInfo.getId());
|
||||
}
|
||||
/**收回序列号的时候释放库存*/
|
||||
depotItem.setOpernumber(BigDecimal.ZERO);
|
||||
depotItem.setBasicnumber(BigDecimal.ZERO);
|
||||
this.updateDepotItemWithObj(depotItem);
|
||||
}
|
||||
depotItem.setId(tempUpdatedJson.getLong("Id"));
|
||||
depotItem.setMaterialid(tempUpdatedJson.getLong("MaterialId"));
|
||||
@@ -405,13 +417,14 @@ public class DepotItemService {
|
||||
BigDecimal oNumber = tempUpdatedJson.getBigDecimal("OperNumber");
|
||||
Long mId = Long.parseLong(tempUpdatedJson.get("MaterialId").toString());
|
||||
//以下进行单位换算
|
||||
String UnitName = findUnitName(mId); //查询计量单位名称
|
||||
if (!StringUtil.isEmpty(UnitName)) {
|
||||
String UnitList = UnitName.substring(0, UnitName.indexOf("("));
|
||||
String RatioList = UnitName.substring(UnitName.indexOf("("));
|
||||
String basicUnit = UnitList.substring(0, UnitList.indexOf(",")); //基本单位
|
||||
String otherUnit = UnitList.substring(UnitList.indexOf(",") + 1); //副单位
|
||||
Integer ratio = Integer.parseInt(RatioList.substring(RatioList.indexOf(":") + 1).replace(")", "")); //比例
|
||||
// String UnitName = findUnitName(mId); //查询计量单位名称
|
||||
String unitName = materialService.findUnitName(mId);
|
||||
if (!StringUtil.isEmpty(unitName)) {
|
||||
String unitList = unitName.substring(0, unitName.indexOf("("));
|
||||
String ratioList = unitName.substring(unitName.indexOf("("));
|
||||
String basicUnit = unitList.substring(0, unitList.indexOf(",")); //基本单位
|
||||
String otherUnit = unitList.substring(unitList.indexOf(",") + 1); //副单位
|
||||
Integer ratio = Integer.parseInt(ratioList.substring(ratioList.indexOf(":") + 1).replace(")", "")); //比例
|
||||
if (Unit.equals(basicUnit)) { //如果等于基础单位
|
||||
depotItem.setBasicnumber(oNumber); //数量一致
|
||||
} else if (Unit.equals(otherUnit)) { //如果等于副单位
|
||||
@@ -457,7 +470,7 @@ public class DepotItemService {
|
||||
depotItem.setMtype(tempUpdatedJson.getString("MType"));
|
||||
/**出库时处理序列号*/
|
||||
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
|
||||
if(getCurrentInStock(depotItem.getMaterialid())<depotItem.getOpernumber().intValue()){
|
||||
if(getCurrentInStock(depotItem.getMaterialid())<depotItem.getBasicnumber().intValue()){
|
||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_CODE,
|
||||
String.format(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_MSG,material==null?"":material.getName()));
|
||||
}
|
||||
|
||||
@@ -286,14 +286,15 @@ public class SerialNumberService {
|
||||
if(depotItem!=null){
|
||||
//查询商品下已分配的可用序列号数量
|
||||
int SerialNumberSum= serialNumberMapperEx.countSerialNumberByMaterialIdAndDepotheadId(depotItem.getMaterialid(),null,BusinessConstants.IS_SELL_HOLD);
|
||||
if(depotItem.getOpernumber().intValue()>SerialNumberSum){
|
||||
//BasicNumber=OperNumber*ratio
|
||||
if(depotItem.getBasicnumber().intValue()>SerialNumberSum){
|
||||
//获取商品名称
|
||||
Material material= materialMapper.selectByPrimaryKey(depotItem.getMaterialid());
|
||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_SERIAL_NUMBERE_NOT_ENOUGH_CODE,
|
||||
String.format(ExceptionConstants.MATERIAL_SERIAL_NUMBERE_NOT_ENOUGH_MSG,material==null?"":material.getName()));
|
||||
}
|
||||
//商品下序列号充足,分配序列号
|
||||
sellSerialNumber(depotItem.getMaterialid(),depotItem.getHeaderid(),depotItem.getOpernumber().intValue(),userInfo);
|
||||
sellSerialNumber(depotItem.getMaterialid(),depotItem.getHeaderid(),depotItem.getBasicnumber().intValue(),userInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user