Commit 853128f1 authored by Yonggang Yuan's avatar Yonggang Yuan

Merge branch 'custom-for-wangli' of git@182.92.242.253:originstar/drp.git into custom-for-wangli

parents 209a09f7 293ad776
......@@ -3,8 +3,6 @@ package com.originspark.drp.controllers.projects.costs;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
......@@ -18,7 +16,6 @@ import com.originspark.drp.controllers.BaseController;
import com.originspark.drp.models.projects.costs.StockInCost;
import com.originspark.drp.models.projects.invoices.StockInInvoice;
import com.originspark.drp.service.projects.costs.StockInCostService;
import com.originspark.drp.util.SessionUtil;
import com.originspark.drp.util.json.FilterRequest;
import com.originspark.drp.util.json.JsonUtils;
......@@ -31,18 +28,18 @@ public class StockInCostController extends BaseController{
@RequestMapping(method = RequestMethod.POST)
@ResponseBody
public String create(@RequestBody StockInCost stockInCost,HttpServletRequest request) {
public String create(@RequestBody StockInCost stockInCost) {
StockInInvoice invoiceUI = stockInCost.getInvoice();
if(invoiceUI == null){
return failure("所选入库单不能为空");
}
StockInInvoice invoice = stockInInvoiceService.findById(invoiceUI.getId());
if(invoice == null){
return failure("你所选择的入库单不存在,请重新选择");
}
//检查该商品是否已经存在
boolean have = false;
for(StockInCost cost : invoice.getCosts()){
......@@ -51,14 +48,14 @@ public class StockInCostController extends BaseController{
break;
}
}
if(have){
if(have) {
return failure("抱歉,不能重复添加商品");
}
stockInCost.setCreatedBy(SessionUtil.getCurrentUserName(request));
stockInCost.setCreatedBy(getCurrentUser().getName());
stockInCost.setForDate(invoice.getForDate());
service.save(stockInCost);
return ok("创建成功");
}
......@@ -72,19 +69,18 @@ public class StockInCostController extends BaseController{
@RequestMapping(value = "/{id}", method = RequestMethod.PUT)
@ResponseBody
public String update(@PathVariable Long id, @RequestBody StockInCost stockInCost,HttpServletRequest request) {
public String update(@PathVariable Long id, @RequestBody StockInCost stockInCost) {
StockInCost existingStockInCost = service.findById(StockInCost.class, id);
if (existingStockInCost == null) {
return failure("您要更新的商品不存在");
return failure("您要更新的记录不存在");
}
existingStockInCost.setUnitPrice(stockInCost.getUnitPrice());
existingStockInCost.setQuantity(stockInCost.getQuantity());
existingStockInCost.setUpdatedBy(SessionUtil.getCurrentUserName(request));
existingStockInCost.setUpdatedBy(getCurrentUser().getName());
service.update(existingStockInCost);
return ok("更新成功");
}
......@@ -103,5 +99,5 @@ public class StockInCostController extends BaseController{
return ok(data, count);
}
}
......@@ -16,71 +16,43 @@ import org.springframework.web.bind.annotation.ResponseBody;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.originspark.drp.models.projects.invoices.StockInInvoice;
import com.originspark.drp.util.SessionUtil;
import com.originspark.drp.util.enums.AuditState;
import com.originspark.drp.util.json.AuditStateUpdateJson;
import com.originspark.drp.util.json.IdsJson;
import com.originspark.drp.util.json.FilterRequest;
import com.originspark.drp.util.json.IdsJson;
import com.originspark.drp.util.json.JsonUtils;
@Controller
@RequestMapping("stockInInvoice")
@RequestMapping("invoices/in")
public class StockInInvoiceController extends AbstractInvoiceController {
private Logger logger = Logger.getLogger(StockInInvoiceController.class);
/*@RequestMapping(method = RequestMethod.POST)
@RequestMapping(method = RequestMethod.POST)
@ResponseBody
public String create(@RequestBody StockInInvoice invoice,HttpServletRequest request) {
Project systemUI = invoice.getSystem();
if(systemUI == null){
return failure("所选系统不能为空");
}
Project system = projectService.findById(systemUI.getId());
if(system==null){
return failure("你所选择的系统不存在,请重新选择");
}
invoice.setMaterialKeeperName(system.getMaterialKeeperName());
invoice.setWareKeeperName(system.getWareKeeperName());
invoice.setProjectManagerName(system.getProjectManagerName());
String currentUserName = SessionUtil.getCurrentUserName(request);
invoice.setCreatedByUserName(currentUserName);
public String create(@RequestBody StockInInvoice invoice) {
invoice.setCreatedBy(getCurrentUser().getName());
StockInInvoice savedInvoice = stockInInvoiceService.save(invoice);
logger.info(">添加成功:"+savedInvoice.toString());
return ok("系统确认成功",savedInvoice.getId());
return ok("信息确认成功", savedInvoice.getId());
}
@RequestMapping(value = "/{id}", method = RequestMethod.PUT)
@ResponseBody
public String update(@PathVariable Long id, @RequestBody StockInInvoice invoice,HttpServletRequest request) {
public String update(@PathVariable Long id, @RequestBody StockInInvoice invoice) {
StockInInvoice existingInvoice = stockInInvoiceService.findById(StockInInvoice.class, id);
if (existingInvoice == null) {
return failure("您要更新的入库单不存在");
}
Project systemUI = invoice.getSystem();
if(systemUI != null){
if(systemUI.getId() != null){
Project system = projectService.findById(systemUI.getId());
existingInvoice.setSystem(system);
}
}
existingInvoice.setForDate(invoice.getForDate());
existingInvoice.setCode(invoice.getCode());
existingInvoice.setTotalPrice(invoice.getTotalPrice());
existingInvoice.setUpdatedByUserName(SessionUtil.getCurrentUserName(request));
existingInvoice.setUpdatedBy(getCurrentUser().getName());
stockInInvoiceService.update(existingInvoice);
return ok("更新成功",existingInvoice.getId());
}*/
return ok("更新成功", existingInvoice.getId());
}
@RequestMapping(method = RequestMethod.GET)
@ResponseBody
......@@ -100,8 +72,8 @@ public class StockInInvoiceController extends AbstractInvoiceController {
@RequestMapping(value = "/deleteBatch", method = RequestMethod.GET)
@ResponseBody
public String deleteBatch(HttpServletRequest request) {
String data = request.getParameter("data");
public String deleteBatch() {
String data = request().getParameter("data");
ObjectMapper mapper = new ObjectMapper();
IdsJson json = null;
......@@ -120,7 +92,7 @@ public class StockInInvoiceController extends AbstractInvoiceController {
continue;
}
StockInInvoice invoice = stockInInvoiceService.findById(StockInInvoice.class, id);
if(invoice != null && invoice.getCosts().isEmpty()){
stockInInvoiceService.delete(invoice);
logger.info(">删除成功:"+invoice.toString());
......@@ -130,46 +102,4 @@ public class StockInInvoiceController extends AbstractInvoiceController {
return ok("删除成功(注释:部分合价不为0的入库单已忽略)");
}
/*@RequestMapping(value = "/updateAuditState", method = RequestMethod.GET)
@ResponseBody
public String updateAuditStateByUser(HttpServletRequest request) {
String data = request.getParameter("data");
ObjectMapper mapper = new ObjectMapper();
AuditStateUpdateJson json = null;
try {
json = mapper.readValue(data, AuditStateUpdateJson.class);
} catch (Exception e) {
return failure("提交数据有误");
}
if (json == null) {
return failure("没有需要审核的数据");
}
// 对当前登录用户的验证
AbstractUser user = SessionUtil.getCurrentUser(request);
Long userId = json.getUserId();
String userType = json.getUserType();
if (user.getId() != userId || !user.getType().equals(userType)) {
return failure("操作失败,无审核权限");
}
AuditState state = json.getState();
for (Long id : json.getInvoiceIds()) {
if(id == null){
continue;
}
StockInInvoice inInvoice = stockInInvoiceService.findById(StockInInvoice.class, id);
updateState(inInvoice, userType, state);
stockInInvoiceService.update(inInvoice);
}
return ok("提交成功");
}*/
}
......@@ -56,6 +56,11 @@ public abstract class AbstractInvoice extends AbstractModel{
*/
private String regulator;
/**
* 领用人
*/
private String receiveMan;
public static enum COLUMNS {
STARTDATE,ENDDATE,CODE,
MINTOTAL,MAXTOTAL,PROJECT,SYSTEM,
......@@ -122,6 +127,14 @@ public abstract class AbstractInvoice extends AbstractModel{
this.totalPrice = totalPrice;
}
public String getReceiveMan() {
return receiveMan;
}
public void setReceiveMan(String receiveMan) {
this.receiveMan = receiveMan;
}
@Override
public String toString() {
return super.toString()+", code="+code+", forDate="+forDate+", totalPrice="+totalPrice;
......
......@@ -25,9 +25,9 @@ public class StockOutInvoice extends AbstractInvoice{
private List<StockOutCost> costs;
/**
* 领用人
* 联系地址
*/
private String receiveMan;
private String address;
public List<StockOutCost> getCosts() {
return costs;
......@@ -37,20 +37,15 @@ public class StockOutInvoice extends AbstractInvoice{
this.costs = costs;
}
public String getReceiveMan() {
return receiveMan;
public String getAddress() {
return address;
}
public void setReceiveMan(String receiveMan) {
this.receiveMan = receiveMan;
public void setAddress(String address) {
this.address = address;
}
public int getCostCount(){
return getCosts().size();
}
@Override
public String toString() {
return "StockInInvoice(出库单) => ["+super.toString()+", receiveMan="+receiveMan+"]";
}
}
/**
* @author Yestin
* @author ReedMi
*/
Ext.define("drp.app.controller.projects.invoices.StockInInvoiceController", {
extend : "drp.app.controller.AbstractController",
......@@ -16,7 +16,7 @@ Ext.define("drp.app.controller.projects.invoices.StockInInvoiceController", {
init : function() {
inInvoiceController = this;
this.control({
'stockininvoiceview' : {
afterrender : function(panel) {
inInvoiceCostWin = false;
......@@ -24,20 +24,12 @@ Ext.define("drp.app.controller.projects.invoices.StockInInvoiceController", {
currentInvoice = null;
wareWindow= false;
invoiceGrid = panel.down('gridpanel');
// //只有材料员可以新建删除出库单
// if(user.type != "MaterialKeeper"){
// invoiceGrid.down('#addInInvoice_btn').setVisible(false);
// invoiceGrid.down('#deleteInInvoice_btn').setVisible(false);
// }
// if(user.type == "Leader"){
// invoiceGrid.down('#operationInInvoice_tb').setVisible(false);
// }
invoiceGrid.getStore().load();
}
},
//stock_in_invoice filter
'stockininvoiceview > gridpanel' : {
afterrender : this.buildFiltersByLoginUser,
itemdblclick : this.showUpdateInInvoiceForm
},
......@@ -56,16 +48,6 @@ Ext.define("drp.app.controller.projects.invoices.StockInInvoiceController", {
click : this.deleteInInvoice
},
//stock_in_invoice approve-submit
'stockininvoiceview button[action=approveInInvoice]' : {
click : this.approveInInvoice
},
//stock_in_invoice unapprove-submit
'stockininvoiceview button[action=unapproveInInvoice]' : {
click : this.unapproveInInvoice
},
//----------------------------------------------------------------
'stockincostview' : {
afterrender : function(panel) {
......@@ -74,10 +56,10 @@ Ext.define("drp.app.controller.projects.invoices.StockInInvoiceController", {
},
beforehide : this.updateInvoiceTotalPrice
},
//stock_in_cost add system info
'stockincostview button[action=addSystemInfo]' : {
click : this.addSystemInfo
//确认单据头信息
'stockincostview button[action=confirmInvoiceHeader]' : {
click : this.confirmInvoiceHeader
},
//stock_in_cost save
......@@ -138,7 +120,7 @@ Ext.define("drp.app.controller.projects.invoices.StockInInvoiceController", {
});
},
//入库单-查询
searchStockInInvoice : function(btn){
var store = invoiceGrid.getStore();
......@@ -150,12 +132,6 @@ Ext.define("drp.app.controller.projects.invoices.StockInInvoiceController", {
}, {
property : "endDate",
value : Ext.Date.format(form.down("#endDate_filter").getValue(),'Y-m-d')
}, {
property : "project",
value : form.down("#projectName_filter").getValue()
}, {
property : "system",
value : form.down("#systemName_filter").getValue()
}, {
property : "minTotal",
value : form.down("#minTotal_filter").getValue()
......@@ -166,49 +142,16 @@ Ext.define("drp.app.controller.projects.invoices.StockInInvoiceController", {
property : "wareName",
value : form.down("#wareName_filter").getValue()
}, {
property : "materialKeeperName",
value : form.down("#materialKeeperName_filter").getValue()
property : "regulatorName",
value : form.down("#regulatorName_filter").getValue()
}, {
property : "wareKeeperName",
value : form.down("#wareKeeperName_filter").getValue()
}, {
property : "projectManagerName",
value : form.down("#projetManagerName_filter").getValue()
property : "managerName",
value : form.down("#managerName_filter").getValue()
} ]);
},
//根据当前登录用户过滤入库单
buildFiltersByLoginUser : function(grid){
var filters = [];
var index = 0;
if(user.type == "MaterialKeeper"){
filters[index++] = new Object({
property : "materialKeeperId",
value : user.id
});
}else if(user.type == "WareKeeper"){
filters[index++] = {
property : "materialKeeperAuditState",
value : "APPROVED"
};
filters[index++] = {
property : "wareKeeperId",
value : user.id
};
}else if(user.type == "ProjectManager"){
filters[index++] = new Object({
property : "wareKeeperAuditState",
value : "APPROVED"
});
filters[index++] = new Object({
property : "projectManagerId",
value : user.id
});
}
var store = grid.getStore();
store.filters.clear();
store.filter(filters);
},
//入库商品-删除
deleteStockInCost : function(btn) {
......@@ -293,33 +236,26 @@ Ext.define("drp.app.controller.projects.invoices.StockInInvoiceController", {
inInvoiceCostWin.down('#totalPrice_stockInCost_df').setValue(0);
inInvoiceCostWin.down('#systemInfo_stockInCost_form').getForm().reset();
inInvoiceCostWin.down('#stockInCost_form').getForm().reset();
//设置bottom toolbar
var wareKeeperName = inInvoiceCostWin.down('#wareKeeperName_df');
var materialKeeperName = inInvoiceCostWin.down('#materialKeeperName_df');
var projectManagerName = inInvoiceCostWin.down('#projectManagerName_df');
wareKeeperName.setValue("");
materialKeeperName.setValue("");
projectManagerName.setValue("");
inInvoiceCostWin.setTitle("新增入库单");
inInvoiceCostWin.show();
},
showUpdateInInvoiceForm : function( grid, record, item, index){
currentInvoice = record;//在弹出更新的窗口时,保存选中的invoice
var invoiceData = record.data;
var costWin = null;
//1.非材料员登陆的,只提供预览
//2.若是材料员,则pass=true的和已经通过审核的,只提供预览
if(user.type != "MaterialKeeper" || invoiceData.pass || invoiceData.materialKeeperAuditState =="APPROVED"){
if(user.type != "WAREKEEPER"){
if(!invoiceCostWin){
invoiceCostWin = Ext.widget('stockincostshowview');
}
costWin = invoiceCostWin;
invoiceCostWin.setTitle("查看入库单");
}else{
} else {
if(!inInvoiceCostWin){
inInvoiceCostWin = Ext.widget('stockincostview');
}
......@@ -328,31 +264,29 @@ Ext.define("drp.app.controller.projects.invoices.StockInInvoiceController", {
costWin.down('#stockInCost_form').getForm().reset();
inInvoiceCostWin.setTitle("更新入库单");
}
var store = costWin.down("gridpanel").getStore();
store.filters.clear();
store.filter([{
property : "invoice",
value : currentInvoice.data.id
}]);
costWin.down('#systemInfo_stockInCost_form').loadRecord(record);
//设置bottom form,包括材料员、库管员、项目经理的名字
var materialKeeperName = costWin.down('#materialKeeperName_df');
costWin.down('#stockInCost_form').loadRecord(record);
//设置bottom toolbar
var managerName = costWin.down('#managerName_df');
var wareKeeperName = costWin.down('#wareKeeperName_df');
var projectManagerName = costWin.down('#projectManagerName_df');
materialKeeperName.setValue(invoiceData['materialKeeperName']);
wareKeeperName.setValue(invoiceData['wareKeeperName']);
projectManagerName.setValue(invoiceData['projectManagerName']);
var regulatorName = costWin.down('#regulatorName_df');
managerName.setValue(record.data['manager']);
wareKeeperName.setValue(record.data['wareKeeper']);
regulatorName.setValue(record.data['regulator']);
costWin.show();
},
//入库单-删除
deleteInInvoice : function(btn) {
inInvoiceController.deleteBatchModel(btn,invoiceGrid,"入库单","/stockInInvoice/deleteBatch");
inInvoiceController.deleteBatchModel(btn, invoiceGrid, "入库单", "/invoices/in/deleteBatch");
},
//入库单-更新总价
......@@ -381,79 +315,12 @@ Ext.define("drp.app.controller.projects.invoices.StockInInvoiceController", {
});
},
approveInInvoice : function(btn){
var state = "APPROVED";
var records = invoiceGrid.getSelectionModel().getSelection();
var ids = [];
var index = 0;
for(var i = 0,len = records.length;i<len;i++){
var record = records[i].data;
if(record.pass){
continue;
}
if(user.type=="MaterialKeeper"){
if(record.materialKeeperAuditState !="APPROVED" && record.costCount>0){
ids[index] = record.id;
index++;
}
}else if(user.type=="WareKeeper"){
if(record.materialKeeperAuditState =="APPROVED" && record.wareKeeperAuditState == "UNAUDITED" && record.projectManagerAuditState == "UNAUDITED"){
ids[index] = record.id;
index++;
}
}else if(user.type=="ProjectManager"){
if(record.wareKeeperAuditState == "APPROVED" && record.projectManagerAuditState == "UNAUDITED"){
ids[index] = record.id;
index++;
}
}
}
if(ids.length == 0){
Ext.Msg.alert("提交退回", "该入库单已被提交或者还未添加商品");
return;
}
var data = new Object({
invoiceIds : ids,
userType : user.type,
userId : user.id,
state : state
});
Ext.Ajax.request({
url : "stockInInvoice/updateAuditState",
method : "GET",
params : {
data : Ext.encode(data)
},
success : function(response, operation){
var resp = Ext.decode(response.responseText);
Ext.Msg.alert("成功!", resp.message);
invoiceGrid.getStore().load();
},
failure : function(resp, operation) {
Ext.Msg.alert("失败!", operation.request.scope.reader.jsonData["message"]);
}
});
},
unapproveInInvoice : function(){
inInvoiceController.submitInInvoiceToAudit("UNAPPROVED");
},
addSystemInfo : function(btn){
confirmInvoiceHeader : function(btn){
var modelName = "drp.app.model.projects.invoices.StockInInvoiceModel";
var form = btn.up("form").getForm();
if (form.isValid()) {
var formBean = form.getValues();
var model = Ext.create(modelName, formBean);
model.set("system", {
id : formBean['system.id']
});
model.save({
success : function(response, operation){
invoiceGrid.getStore().load();
......@@ -508,9 +375,11 @@ Ext.define("drp.app.controller.projects.invoices.StockInInvoiceController", {
"drp.app.model.resources.WareModel"],
stores : ["drp.app.store.projects.invoices.StockInInvoiceStore",
"drp.app.store.projects.costs.StockInCostStore",
"drp.app.store.projects.ProjectDataStore",
"drp.app.store.resources.WareStore",
"drp.app.store.resources.VendorStore"],
"drp.app.store.resources.WareStore",
"drp.app.store.resources.VendorStore",
"drp.app.store.users.ManagerStore",
"drp.app.store.users.WareKeeperStore",
"drp.app.store.users.RegulatorStore"],
views : ["drp.app.view.projects.invoices.StockInInvoiceView",
"drp.app.view.projects.costs.StockInCostView",
"drp.app.view.projects.costs.StockInCostShowView",
......
......@@ -24,20 +24,11 @@ Ext.define("drp.app.controller.projects.invoices.StockOutInvoiceController", {
currentInvoice = null;
wareWindow= false;
invoiceGrid = panel.down('gridpanel');
//只有材料员可以新建删除出库单
/*if(user.type != "MaterialKeeper"){
invoiceGrid.down('#addOutInvoice_btn').setVisible(false);
invoiceGrid.down('#deleteOutInvoice_btn').setVisible(false);
}
if(user.type == "Leader"){
invoiceGrid.down('#operationOutInvoice_tb').setVisible(false);
}*/
}
},
//stock_in_invoice filter
'stockoutinvoiceview > gridpanel' : {
afterrender : this.buildFiltersByLoginUser,
itemdblclick : this.showUpdateOutInvoiceForm
},
......@@ -156,12 +147,6 @@ Ext.define("drp.app.controller.projects.invoices.StockOutInvoiceController", {
}, {
property : "endDate",
value : Ext.Date.format(form.down("#endDate_filter").getValue(),'Y-m-d')
}, {
property : "project",
value : form.down("#projectName_filter").getValue()
}, {
property : "system",
value : form.down("#systemName_filter").getValue()
}, {
property : "minTotal",
value : form.down("#minTotal_filter").getValue()
......@@ -175,49 +160,16 @@ Ext.define("drp.app.controller.projects.invoices.StockOutInvoiceController", {
property : "receiveManName",
value : form.down("#receiveManName_filter").getValue()
}, {
property : "materialKeeperName",
value : form.down("#materialKeeperName_filter").getValue()
property : "regulatorName",
value : form.down("#regulatorName_filter").getValue()
}, {
property : "wareKeeperName",
value : form.down("#wareKeeperName_filter").getValue()
}, {
property : "projectManagerName",
value : form.down("#projetManagerName_filter").getValue()
property : "managerName",
value : form.down("#managerName_filter").getValue()
} ]);
},
//根据当前登录用户过滤出库单
buildFiltersByLoginUser : function(grid){
var filters = [];
var index = 0;
if(user.type == "MaterialKeeper"){
filters[index++] = new Object({
property : "materialKeeperId",
value : user.id
});
}else if(user.type == "WareKeeper"){
filters[index++] = {
property : "materialKeeperAuditState",
value : "APPROVED"
};
filters[index++] = {
property : "wareKeeperId",
value : user.id
};
}else if(user.type == "ProjectManager"){
filters[index++] = new Object({
property : "wareKeeperAuditState",
value : "APPROVED"
});
filters[index++] = new Object({
property : "projectManagerId",
value : user.id
});
}
var store = grid.getStore();
store.filters.clear();
store.filter(filters);
},
//入库商品-删除
deleteStockOutCost : function(btn) {
......
......@@ -5,40 +5,16 @@ Ext.define("drp.app.model.projects.invoices.AbstractInvoiceModel", {
}, {
name : "forDate"
}, {
name : "system"
name : 'manager'
}, {
name : "system.id",
persist : false
name : 'wareKeeper'
}, {
name : "system.projectName",
persist : false
name : 'regulator'
}, {
name : "system.name",
persist : false
name : "receiveMan"
}, {
name : "totalPrice",
type : "number"
}, {
name : "materialKeeperName",
persist : false
}, {
name : "wareKeeperName",
persist : false
}, {
name : "projectManagerName",
persist : false
}, {
name : "wareKeeperAuditState",
persist : false
}, {
name : "materialKeeperAuditState",
persist : false
}, {
name : "projectManagerAuditState",
persist : false
}, {
name : "pass",
type : "boolean"
}, {
name : "costCount",
type : "int",
......
......@@ -2,7 +2,7 @@ Ext.define("drp.app.model.projects.invoices.StockInInvoiceModel", {
extend : "drp.app.model.projects.invoices.AbstractInvoiceModel",
proxy : {
type : 'rest',
url : 'stockInInvoice',
url : 'invoices/in',
reader : {
type : "json",
root : "data",
......
Ext.define("drp.app.model.projects.invoices.StockOutInvoiceModel", {
extend : "drp.app.model.projects.invoices.AbstractInvoiceModel",
fields : [{
name : "receiveMan"
name : "address"
} ],
proxy : {
type : 'rest',
url : 'stockOutInvoice',
url : 'invoices/out',
reader : {
type : "json",
root : "data",
......
......@@ -2,7 +2,7 @@ Ext.define("drp.app.store.AbstractStore", {
extend : 'Ext.data.Store',
model : 'drp.app.model.AbstractModel',
pageSize : 50,
autoLoad : false,
// autoLoad : false,
remoteFilter : true,
remoteSort : true
});
\ No newline at end of file
......@@ -22,7 +22,7 @@ Ext.define('drp.app.view.projects.resources.StockInCostShowView', {
height: 40,
items : [{
xtype : 'form',
itemId : 'systemInfo_stockInCost_form',
itemId : 'stockInCost_form',
items : [{
xtype : 'fieldcontainer',
layout : 'column',
......@@ -30,16 +30,9 @@ Ext.define('drp.app.view.projects.resources.StockInCostShowView', {
xtype : 'displayfield',
margin : '5 0 0 15',
labelWidth: 30,
name : 'system.projectName',
name : 'receiveMan',
width : 200,
fieldLabel : '项目'
}, {
xtype : 'displayfield',
margin : '5 0 0 15',
labelWidth: 30,
name : 'system.name',
width : 200,
fieldLabel : '系统'
fieldLabel : '收到'
}, {
xtype: 'displayfield',
fieldLabel: '日期',
......@@ -108,25 +101,23 @@ Ext.define('drp.app.view.projects.resources.StockInCostShowView', {
flex : 1,
margin : '0 0 0 30',
labelWidth: 50,
itemId : 'wareKeeperName_df',
fieldLabel : '库管员'
itemId : 'managerName_df',
fieldLabel : '负责人'
}, {
xtype : 'displayfield',
flex : 1,
labelWidth: 50,
itemId : 'materialKeeperName_df',
fieldLabel : '材料'
itemId : 'wareKeeperName_df',
fieldLabel : '库管'
}, {
xtype : 'displayfield',
flex : 1,
labelWidth: 60,
itemId : 'projectManagerName_df',
fieldLabel : '项目经理'
itemId : 'regulatorName_df',
fieldLabel : '经手人'
}]
}]
});
me.callParent(arguments);
}
});
\ No newline at end of file
......@@ -34,116 +34,89 @@ Ext.define('drp.app.view.projects.resources.StockInCostView', {
items : [{
xtype : 'fieldcontainer',
layout : 'column',
items : [{
xtype : 'textfield',//入库单的id
itemId : 'id_stockInInvoice',
hidden : true,
name : 'id'
}, {
xtype : 'combobox',
items : [ {
xtype: 'textfield',
fieldLabel: '收到<font color="red">*</font>',
itemId : 'receiveMan_stockInInvoice_tf',
allowBlank: false,
name : 'receiveMan',
margin : '5 0 0 15',
width : 200,
labelWidth: 60
}, {
xtype: 'datefield',
fieldLabel: '日期<font color="red">*</font>',
margin : '5 0 0 15',
labelWidth: 60,
itemId : 'project_stockInInvoice_cb',
name : 'system.projectName',
itemId : 'forDate_stockInInvoice_df',
name : 'forDate',
editable : false,
allowBlank : false,
width : 300,
displayField :"name",
valueField :"id",
fieldLabel : '项目<font color="red">*</font>',
store : 'drp.app.store.projects.ProjectDataStore',
allowBlank: false,
width : 200,
format : 'Y-m-d',
listeners : {
afterrender : function(combo){
//显示人员所属项目
var store = combo.getStore();
if(user.type != "Leader"){
Ext.apply(store.proxy.extraParams, {
userType : user.type,
userId : user.id
});
afterrender : function(df) {
if(df.getValue() == null) {
df.setValue(new Date());
}
},
select : function(combo,records){
var project = records[0].data;
var stockincostview = combo.up("stockincostview");
//设置该项目下的人员
stockincostview.down("#materialKeeperName_df").setValue(project.materialKeeper.name);
stockincostview.down("#wareKeeperName_df").setValue(project.wareKeeper.name);
stockincostview.down("#projectManagerName_df").setValue(project.projectManager.name);
//根据项目动态加载下属系统
var _url = "project/" + project.id;
var system = stockincostview.down("#systemName_stockInInvoice_cb");
system.getStore().getProxy().url = _url;
system.setValue("");
system.setDisabled(false);
}
}
}, {
xtype : 'combobox',
}, {
xtype: 'textfield',
fieldLabel: '编号',
itemId : 'code_stockInInvoice_tf',
name : 'code',
margin : '5 0 0 15',
labelWidth: 60,
itemId : 'systemName_stockInInvoice_cb',
name : 'system.name',
allowBlank : false,
editable : false,
disabled : true,
width : 300,
fieldLabel : '系统<font color="red">*</font>',
valueField : 'id',
displayField : 'name',
fieldLabel : '系统名称<font color="red">*</font>',
store : Ext.create('Ext.data.Store', {
fields : ['id', 'name'],
proxy : {
type : 'ajax',
reader : {
type : "json",
root : "data",
successProperty : 'success'
},
writer : {
type : "json"
}
}
}),
listeners : {
select : function(combo){
combo.up('form').down('#systemId_stockInInvoice_tf').setValue(combo.getSubmitValue());
}
}
}, {
xtype : 'numberfield',
hidden : true,
itemId : 'systemId_stockInInvoice_tf',
name : 'system.id'
width : 200,
labelWidth: 60
}]
}, {
xtype : 'fieldcontainer',
layout : 'column',
items : [ {
xtype: 'datefield',
fieldLabel: '日期<font color="red">*</font>',
margin : '5 0 0 15',
items : [{
xtype : 'textfield',//入库单的id
itemId : 'id_stockInInvoice',
hidden : true,
name : 'id'
}, {
xtype : 'combobox',
width : 200,
labelWidth: 60,
itemId : 'forDate_stockInInvoice_df',
name : 'forDate',
editable : false,
width : 300,
format : 'Y-m-d'
margin : '5 0 0 15',
name : 'manager',
valueField : 'name',
displayField : 'name',
allowBlank: false,
store : 'drp.app.store.users.ManagerStore',
fieldLabel : '负责人<font color="red">*</font>'
}, {
xtype: 'textfield',
fieldLabel: '编号<font color="red">*</font>',
itemId : 'code_stockInInvoice_tf',
name : 'code',
xtype : 'combobox',
width : 200,
labelWidth: 60,
margin : '5 0 0 15',
width : 300,
labelWidth: 60
name : 'wareKeeper',
valueField : 'name',
displayField : 'name',
allowBlank: false,
store : 'drp.app.store.users.WareKeeperStore',
fieldLabel : '库管员<font color="red">*</font>'
}, {
xtype : 'combobox',
width : 200,
labelWidth: 60,
margin : '5 0 0 15',
name : 'regulator',
valueField : 'name',
displayField : 'name',
allowBlank: false,
store : 'drp.app.store.users.RegulatorStore',
fieldLabel : '经手人'
}, {
xtype : 'button',
margin : '5 0 0 65',
action : 'addSystemInfo',
action : 'confirmInvoiceHeader',
icon : 'resources/images/icons/ok.png',
text : '确认所属系统'
text : '确认单据头'
}]
}]
}]
......@@ -233,7 +206,7 @@ Ext.define('drp.app.view.projects.resources.StockInCostView', {
}
}
}]
}],
}]/*,
listeners : {
select : function(grid, record){
var cost = record.data;
......@@ -252,7 +225,7 @@ Ext.define('drp.app.view.projects.resources.StockInCostView', {
inCostForm.down('#wareQuantity_stockInCost_nf').setReadOnly(false);
inCostForm.down('#wareQuantity_stockInCost_nf').setValue(cost.quantity);
}
}
}*/
}, {//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<入库单-商品添加的form
xtype : 'panel',
region : 'south',
......@@ -367,35 +340,9 @@ Ext.define('drp.app.view.projects.resources.StockInCostView', {
}]
}]
}]
}],
dockedItems : [{//<<<<<<<<<<<<<<<<<<<<<<<<入库单-汇总人员信息
xtype: 'toolbar',
dock: 'bottom',
ui: 'footer',
items: [{
xtype : 'displayfield',
flex : 1,
margin : '0 0 0 30',
labelWidth: 50,
itemId : 'wareKeeperName_df',
fieldLabel : '库管员'
}, {
xtype : 'displayfield',
flex : 1,
labelWidth: 50,
itemId : 'materialKeeperName_df',
fieldLabel : '材料员'
}, {
xtype : 'displayfield',
flex : 1,
labelWidth: 60,
itemId : 'projectManagerName_df',
fieldLabel : '项目经理'
}]
}]
});
me.callParent(arguments);
}
});
\ No newline at end of file
......@@ -13,32 +13,15 @@ Ext.define('drp.app.view.projects.invoices.StockInInvoiceView', {
initComponent : function() {
var me = this;
var selModel = Ext.create('Ext.selection.CheckboxModel', {
listeners : {
selectionchange : function(sm, selections) {
me.down('#deleteInInvoice_btn').setDisabled(selections.length == 0);
me.down('#submitInInvoice_btn').setDisabled(selections.length == 0);
}
}
});
var menuItems = [{
xtype : 'button',
action : 'approveInInvoice',
icon : 'resources/images/icons/approved.gif',
text : '提交通过'
}];
if(user.type != "MaterialKeeper"){
menuItems[1]={
xtype : 'button',
action : 'unapproveInInvoice',
icon : 'resources/images/icons/unapproved.gif',
text : '失败退回'
};
}
Ext.applyIf(me, {
items : [{
......@@ -67,18 +50,6 @@ Ext.define('drp.app.view.projects.invoices.StockInInvoiceView', {
fieldLabel : '结束日期',
editable : false,
format : 'Y-m-d'
}, {
xtype : 'textfield',
margin : '5 0 0 20',
labelWidth: 60,
itemId : 'projectName_filter',
fieldLabel : '项目名称'
}, {
xtype : 'textfield',
margin : '5 0 0 20',
labelWidth: 60,
itemId : 'systemName_filter',
fieldLabel : '系统名称'
}]
}, {
xtype : 'fieldcontainer',
......@@ -109,8 +80,8 @@ Ext.define('drp.app.view.projects.invoices.StockInInvoiceView', {
xtype : 'textfield',
margin : '5 0 0 10',
labelWidth: 60,
itemId : 'materialKeeperName_filter',
fieldLabel : '材料员'
itemId : 'regulatorName_filter',
fieldLabel : '经手人'
}, {
xtype : 'textfield',
margin : '5 0 0 20',
......@@ -121,8 +92,8 @@ Ext.define('drp.app.view.projects.invoices.StockInInvoiceView', {
xtype : 'textfield',
margin : '5 0 0 20',
labelWidth: 60,
itemId : 'projetManagerName_filter',
fieldLabel : '项目经理'
itemId : 'managerName_filter',
fieldLabel : '负责人'
}, {
xtype : 'button',
margin : '5 0 0 25',
......@@ -161,14 +132,9 @@ Ext.define('drp.app.view.projects.invoices.StockInInvoiceView', {
dataIndex : 'code'
}, {
xtype : 'gridcolumn',
dataIndex : 'system.projectName',
flex : 2,
text : '项目名称'
}, {
xtype : 'gridcolumn',
dataIndex : 'system.name',
dataIndex : 'receiveMan',
flex : 2,
text : '系统名称'
text : '收到'
}, {
xtype : 'gridcolumn',
dataIndex : 'totalPrice',
......@@ -176,31 +142,19 @@ Ext.define('drp.app.view.projects.invoices.StockInInvoiceView', {
text : '合价'
}, {
xtype : 'gridcolumn',
dataIndex : 'materialKeeperName',
dataIndex : 'manager',
flex : 2,
text : '材料员',
renderer : function(value, metadata, record) {
var materialKeeperAuditState = record.data.materialKeeperAuditState;
return me.displyAuditState(value, materialKeeperAuditState);
}
text : '负责人'
}, {
xtype : 'gridcolumn',
dataIndex : 'wareKeeperName',
dataIndex : 'wareKeeper',
flex : 2,
text : '库管员',
renderer : function(value, metadata, record) {
var wareKeeperAuditState = record.data.wareKeeperAuditState;
return me.displyAuditState(value, wareKeeperAuditState);
}
text : '库管员'
}, {
xtype : 'gridcolumn',
dataIndex : 'projectManagerName',
dataIndex : 'regulatorName',
flex : 2,
text : '项目经理',
renderer : function(value, metadata, record) {
var projectManagerAuditState = record.data.projectManagerAuditState;
return me.displyAuditState(value, projectManagerAuditState);
}
text : '经手人'
}],
dockedItems : [{
xtype : 'pagingtoolbar',
......@@ -224,15 +178,7 @@ Ext.define('drp.app.view.projects.invoices.StockInInvoiceView', {
itemId : 'deleteInInvoice_btn',
disabled : true,
text : '删除'
}/*, {
itemId : 'submitInInvoice_btn',
disabled : true,
text : '提交审核',
icon : 'resources/images/icons/database_save.png',
menu : {
items : menuItems
}
}*/]
}]
}]
}]
......
......@@ -13,7 +13,7 @@ Ext.define('drp.app.view.projects.invoices.StockOutInvoiceView', {
initComponent : function() {
var me = this;
var selModel = Ext.create('Ext.selection.CheckboxModel', {
listeners : {
selectionchange : function(sm, selections) {
......@@ -22,23 +22,7 @@ Ext.define('drp.app.view.projects.invoices.StockOutInvoiceView', {
}
}
});
var menuItems = [{
xtype : 'button',
action : 'approveOutInvoice',
icon : 'resources/images/icons/approved.gif',
text : '提交通过'
}];
if(user.type != "MaterialKeeper"){
menuItems[1]={
xtype : 'button',
action : 'unapproveOutInvoice',
icon : 'resources/images/icons/unapproved.gif',
text : '失败退回'
};
}
Ext.applyIf(me, {
items : [{
......@@ -67,18 +51,6 @@ Ext.define('drp.app.view.projects.invoices.StockOutInvoiceView', {
fieldLabel : '结束日期',
editable : false,
format : 'Y-m-d'
}, {
xtype : 'textfield',
margin : '5 0 0 20',
labelWidth: 60,
itemId : 'projectName_filter',
fieldLabel : '项目名称'
}, {
xtype : 'textfield',
margin : '5 0 0 20',
labelWidth: 60,
itemId : 'systemName_filter',
fieldLabel : '系统名称'
}]
}, {
xtype : 'fieldcontainer',
......@@ -115,7 +87,7 @@ Ext.define('drp.app.view.projects.invoices.StockOutInvoiceView', {
xtype : 'textfield',
margin : '5 0 0 10',
labelWidth: 60,
itemId : 'materialKeeperName_filter',
itemId : 'regulatorName_filter',
fieldLabel : '材料员'
}, {
xtype : 'textfield',
......@@ -127,7 +99,7 @@ Ext.define('drp.app.view.projects.invoices.StockOutInvoiceView', {
xtype : 'textfield',
margin : '5 0 0 20',
labelWidth: 60,
itemId : 'projetManagerName_filter',
itemId : 'managerName_filter',
fieldLabel : '项目经理'
}, {
xtype : 'button',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment